This file is designed to use CDC data to assess coronavirus disease burden by state, including creating and analyzing state-level clusters.
Through March 7, 2021, The COVID Tracking Project collected and integrated data on tests, cases, hospitalizations, deaths, and the like by state and date. The latest code for using this data is available in Coronavirus_Statistics_CTP_v004.Rmd.
The COVID Tracking Project suggest that US federal data sources are now sufficiently robust to be used for analyses that previously relied on COVID Tracking Project. This code is an attempt to update modules in Coronavirus_Statistics_CTP_v004.Rmd to leverage US federal data.
The code in this module builds on code available in _v002 to include vaccines data:
Broadly, the CDC data analyzed by this module includes:
The tidyverse package is loaded and functions are sourced:
# The tidyverse functions are routinely used without package::function format
library(tidyverse)
## -- Attaching packages --------------------------------------- tidyverse 1.3.1 --
## v ggplot2 3.3.3 v purrr 0.3.4
## v tibble 3.1.1 v dplyr 1.0.6
## v tidyr 1.1.3 v stringr 1.4.0
## v readr 1.4.0 v forcats 0.5.1
## -- Conflicts ------------------------------------------ tidyverse_conflicts() --
## x dplyr::filter() masks stats::filter()
## x dplyr::lag() masks stats::lag()
# Functions are available in source file
source("./Generic_Added_Utility_Functions_202105_v001.R")
source("./Coronavirus_CDC_Daily_Functions_v001.R")
A series of mapping files are also available to allow for parameterized processing. Mappings include:
These default parameters are maintained in a separate .R file and can be sourced:
source("./Coronavirus_CDC_Daily_Default_Mappings_v002.R")
The function is tested on existing, previously downloaded data:
readList <- list("cdcDaily"="./RInputFiles/Coronavirus/CDC_dc_downloaded_210801.csv",
"cdcHosp"="./RInputFiles/Coronavirus/CDC_h_downloaded_210801.csv",
"vax"="./RInputFiles/Coronavirus/vaxData_downloaded_210801.csv"
)
compareList <- list("cdcDaily"=readFromRDS("cdc_daily_210708")$dfRaw$cdcDaily,
"cdcHosp"=readFromRDS("cdc_daily_210708")$dfRaw$cdcHosp,
"vax"=readFromRDS("cdc_daily_210728_vaxonly")$dfRaw$vax
)
cdc_daily_210801_test <- readRunCDCDaily(thruLabel="Jul 31, 2021",
downloadTo=lapply(readList, FUN=function(x) if(file.exists(x)) NA else x),
readFrom=readList,
compareFile=compareList,
writeLog=NULL,
useClusters=readFromRDS("cdc_daily_210528")$useClusters,
weightedMeanAggs=c("tcpm7", "tdpm7", "cpm7", "dpm7", "hpm7",
"vxcpm7", "vxcgte65pct"
),
skipAssessmentPlots=FALSE,
brewPalette="Paired"
)
##
## No file has been downloaded, will use existing file: ./RInputFiles/Coronavirus/CDC_dc_downloaded_210801.csv
##
## -- Column specification --------------------------------------------------------
## cols(
## submission_date = col_character(),
## state = col_character(),
## tot_cases = col_double(),
## conf_cases = col_double(),
## prob_cases = col_double(),
## new_case = col_double(),
## pnew_case = col_double(),
## tot_death = col_double(),
## conf_death = col_double(),
## prob_death = col_double(),
## new_death = col_double(),
## pnew_death = col_double(),
## created_at = col_character(),
## consent_cases = col_character(),
## consent_deaths = col_character()
## )
##
## *** File has been checked for uniqueness by: state date
##
##
## Checking for similarity of: column names
## In reference but not in current:
## In current but not in reference:
##
## Checking for similarity of: date
## In reference but not in current: 0
## In current but not in reference: 25
##
## Checking for similarity of: state
## In reference but not in current:
## In current but not in reference:
##
##
## ***Differences of at least 5 and at least 5%
##
## date name newValue refValue absDelta pctDelta
## 1 2020-02-02 tot_deaths 143 152 9 0.06101695
## 2 2020-02-03 tot_deaths 143 152 9 0.06101695
## 3 2020-02-04 tot_deaths 143 152 9 0.06101695
## 4 2020-02-05 tot_deaths 143 152 9 0.06101695
## 5 2020-02-06 tot_deaths 143 152 9 0.06101695
## 6 2020-02-07 tot_deaths 143 152 9 0.06101695
## 7 2020-02-08 tot_deaths 144 153 9 0.06060606
## 8 2020-02-09 tot_deaths 144 153 9 0.06060606
## 9 2020-02-10 tot_deaths 144 153 9 0.06060606
## 10 2020-02-11 tot_deaths 144 153 9 0.06060606
## 11 2020-02-12 tot_deaths 144 153 9 0.06060606
## 12 2020-02-13 tot_deaths 144 153 9 0.06060606
## 13 2020-02-14 tot_deaths 144 153 9 0.06060606
## 14 2020-02-15 tot_deaths 144 153 9 0.06060606
## 15 2020-02-16 tot_deaths 144 153 9 0.06060606
## 16 2020-02-17 tot_deaths 144 153 9 0.06060606
## 17 2020-02-18 tot_deaths 144 153 9 0.06060606
## 18 2020-02-19 tot_deaths 145 154 9 0.06020067
## 19 2020-02-20 tot_deaths 145 154 9 0.06020067
## 20 2020-02-21 tot_deaths 145 154 9 0.06020067
## 21 2020-02-22 tot_deaths 145 154 9 0.06020067
## 22 2020-02-23 tot_deaths 145 154 9 0.06020067
## 23 2020-02-24 tot_deaths 145 154 9 0.06020067
## 24 2020-02-25 tot_deaths 145 154 9 0.06020067
## 25 2020-02-26 tot_deaths 145 154 9 0.06020067
## 26 2020-02-27 tot_deaths 146 155 9 0.05980066
## 27 2020-02-28 tot_deaths 146 155 9 0.05980066
## 28 2020-02-29 tot_deaths 147 156 9 0.05940594
## 29 2020-03-01 tot_deaths 147 156 9 0.05940594
## 30 2020-03-02 tot_deaths 153 162 9 0.05714286
## 31 2020-03-03 tot_deaths 156 165 9 0.05607477
## 32 2020-03-04 tot_deaths 158 167 9 0.05538462
## 33 2020-03-05 tot_deaths 160 169 9 0.05471125
## 34 2020-03-06 tot_deaths 163 172 9 0.05373134
## 35 2020-03-07 tot_deaths 168 177 9 0.05217391
## 36 2020-03-08 tot_deaths 173 182 9 0.05070423
## 37 2020-02-02 tot_cases 510 612 102 0.18181818
## 38 2020-02-03 tot_cases 542 644 102 0.17200675
## 39 2020-02-04 tot_cases 550 652 102 0.16971714
## 40 2020-02-05 tot_cases 555 657 102 0.16831683
## 41 2020-02-06 tot_cases 557 658 101 0.16625514
## 42 2020-02-07 tot_cases 562 663 101 0.16489796
## 43 2020-02-08 tot_cases 570 670 100 0.16129032
## 44 2020-02-09 tot_cases 605 705 100 0.15267176
## 45 2020-02-10 tot_cases 614 713 99 0.14920874
## 46 2020-02-11 tot_cases 625 721 96 0.14264487
## 47 2020-02-12 tot_cases 635 731 96 0.14055637
## 48 2020-02-13 tot_cases 641 736 95 0.13798112
## 49 2020-02-14 tot_cases 649 743 94 0.13505747
## 50 2020-02-15 tot_cases 654 748 94 0.13409415
## 51 2020-02-16 tot_cases 667 758 91 0.12771930
## 52 2020-02-17 tot_cases 685 776 91 0.12457221
## 53 2020-02-18 tot_cases 692 783 91 0.12338983
## 54 2020-02-19 tot_cases 709 799 90 0.11936340
## 55 2020-02-20 tot_cases 723 811 88 0.11473272
## 56 2020-02-21 tot_cases 742 829 87 0.11075748
## 57 2020-02-22 tot_cases 768 855 87 0.10720887
## 58 2020-02-23 tot_cases 792 877 85 0.10185740
## 59 2020-02-24 tot_cases 811 896 85 0.09958992
## 60 2020-02-25 tot_cases 835 920 85 0.09686610
## 61 2020-02-26 tot_cases 879 963 84 0.09120521
## 62 2020-02-27 tot_cases 916 998 82 0.08568443
## 63 2020-02-28 tot_cases 968 1049 81 0.08031730
## 64 2020-02-29 tot_cases 1005 1087 82 0.07839388
## 65 2020-03-01 tot_cases 1094 1177 83 0.07309555
## 66 2020-03-02 tot_cases 1172 1254 82 0.06760099
## 67 2020-03-03 tot_cases 1343 1424 81 0.05854716
## 68 2020-03-04 tot_cases 1482 1565 83 0.05447982
## 69 2021-07-05 new_deaths 104 37 67 0.95035461
## 70 2021-07-04 new_deaths 98 38 60 0.88235294
## 71 2021-01-18 new_deaths 2674 1130 1544 0.81177708
## 72 2021-07-03 new_deaths 140 86 54 0.47787611
## 73 2021-01-19 new_deaths 3036 4578 1542 0.40504334
## 74 2020-12-26 new_deaths 2248 3093 845 0.31642015
## 75 2020-12-24 new_deaths 3274 2463 811 0.28272616
## 76 2021-06-27 new_deaths 139 105 34 0.27868852
## 77 2021-06-20 new_deaths 176 145 31 0.19314642
## 78 2021-06-26 new_deaths 172 142 30 0.19108280
## 79 2021-06-19 new_deaths 180 154 26 0.15568862
## 80 2021-06-28 new_deaths 193 170 23 0.12672176
## 81 2021-06-24 new_deaths 287 258 29 0.10642202
## 82 2021-06-17 new_deaths 334 302 32 0.10062893
## 83 2021-06-23 new_deaths 310 281 29 0.09813875
## 84 2021-06-25 new_deaths 300 273 27 0.09424084
## 85 2021-06-22 new_deaths 283 258 25 0.09242144
## 86 2021-06-18 new_deaths 210 192 18 0.08955224
## 87 2021-06-13 new_deaths 200 184 16 0.08333333
## 88 2021-05-30 new_deaths 237 220 17 0.07439825
## 89 2020-03-21 new_deaths 114 107 7 0.06334842
## 90 2021-06-11 new_deaths 326 306 20 0.06329114
## 91 2021-06-16 new_deaths 310 293 17 0.05638474
## 92 2021-06-15 new_deaths 336 319 17 0.05190840
## 93 2020-02-02 new_cases 1 557 556 1.99283154
## 94 2021-07-05 new_cases 11563 3575 7988 1.05535738
## 95 2021-07-04 new_cases 12794 4156 8638 1.01923304
## 96 2021-07-03 new_cases 14978 5887 9091 0.87141145
## 97 2021-06-10 new_cases 16732 12363 4369 0.30032652
## 98 2021-01-18 new_cases 138853 107646 31207 0.25320184
## 99 2021-01-19 new_cases 145009 176292 31283 0.19472706
## 100 2021-07-02 new_cases 16830 14183 2647 0.17070261
## 101 2021-06-20 new_cases 9228 7787 1441 0.16937996
## 102 2020-12-24 new_cases 222824 195402 27422 0.13113484
## 103 2021-06-01 new_cases 9689 8540 1149 0.12606287
## 104 2021-01-29 new_cases 156344 139722 16622 0.11228577
## 105 2020-12-26 new_cases 151874 169350 17476 0.10880881
## 106 2021-06-30 new_cases 17295 15526 1769 0.10779684
## 107 2021-06-28 new_cases 9690 8701 989 0.10755261
## 108 2021-06-09 new_cases 19404 21526 2122 0.10368923
## 109 2021-01-09 new_cases 249812 226455 23357 0.09808364
## 110 2021-01-30 new_cases 137321 150808 13487 0.09361779
## 111 2021-07-01 new_cases 18730 17149 1581 0.08812955
## 112 2021-06-08 new_cases 14356 15667 1311 0.08733304
## 113 2021-06-29 new_cases 16159 15051 1108 0.07100288
## 114 2021-06-06 new_cases 12102 11304 798 0.06818764
## 115 2020-07-14 new_cases 65684 61818 3866 0.06064219
## 116 2021-01-08 new_cases 295289 312357 17068 0.05617745
## 117 2021-05-24 new_cases 15657 14828 829 0.05438740
## 118 2021-05-31 new_cases 9193 9700 507 0.05367067
## 119 2021-05-03 new_cases 33239 31601 1638 0.05052437
## 120 2021-06-07 new_cases 10122 10644 522 0.05027449
## 121 2020-07-15 new_cases 70320 73939 3619 0.05017365
##
##
## ***Differences of at least 0 and at least 0.1%
##
## state name newValue refValue absDelta pctDelta
## 1 IN tot_deaths 3407157 3378244 28913 0.008522120
## 2 SC tot_deaths 2291589 2305862 14273 0.006209093
## 3 CA tot_deaths 14183041 14129523 53518 0.003780512
## 4 NC tot_deaths 3073917 3062861 11056 0.003603194
## 5 MS tot_deaths 1998075 1991323 6752 0.003384972
## 6 KY tot_deaths 1634463 1630052 4411 0.002702392
## 7 RI tot_deaths 749883 751479 1596 0.002126070
## 8 NM tot_deaths 1001515 999916 1599 0.001597857
## 9 AL tot_deaths 2742024 2738028 3996 0.001458380
## 10 CA tot_cases 865747767 837321729 28426038 0.033382123
## 11 SC tot_cases 129358076 129977727 619651 0.004778754
## 12 RI tot_cases 32453898 32591078 137180 0.004218004
## 13 AL tot_cases 131847795 131406619 441176 0.003351708
## 14 MI tot_cases 214132223 214386719 254496 0.001187793
## 15 MS tot_cases 77187328 77104046 83282 0.001079542
## 16 MS new_deaths 7432 7332 100 0.013546464
## 17 NM new_deaths 4382 4344 38 0.008709603
## 18 CA new_deaths 63517 62992 525 0.008299805
## 19 KY new_deaths 7285 7229 56 0.007716687
## 20 NC new_deaths 13517 13434 83 0.006159326
## 21 AL new_deaths 11430 11360 70 0.006143045
## 22 MI new_deaths 21076 20995 81 0.003850633
## 23 IN new_deaths 13914 13863 51 0.003672103
## 24 TX new_deaths 51507 51349 158 0.003072256
## 25 TN new_deaths 12611 12576 35 0.002779211
## 26 WA new_deaths 5954 5939 15 0.002522492
## 27 RI new_deaths 2736 2730 6 0.002195390
## 28 UT new_deaths 2371 2368 3 0.001266090
## 29 CA new_cases 3880232 3713944 166288 0.043793560
## 30 VI new_cases 3932 3916 16 0.004077472
## 31 MS new_cases 323003 321780 1223 0.003793524
## 32 AL new_cases 554270 552325 1945 0.003515288
## 33 LA new_cases 483605 482096 1509 0.003125191
## 34 NV new_cases 335771 334763 1008 0.003006559
## 35 FL new_cases 2344516 2337613 6903 0.002948659
## 36 WY new_cases 62592 62445 147 0.002351304
## 37 UT new_cases 416971 416110 861 0.002067026
## 38 KS new_cases 319154 318515 639 0.002004175
## 39 WA new_cases 453368 452483 885 0.001953964
## 40 AK new_cases 68595 68478 117 0.001707120
## 41 MI new_cases 1002081 1000375 1706 0.001703908
## 42 OR new_cases 209377 209035 342 0.001634752
## 43 NC new_cases 1015407 1014359 1048 0.001032631
##
##
##
## Raw file for cdcDaily:
## Rows: 33,360
## Columns: 15
## $ date <date> 2021-02-02, 2020-07-30, 2020-05-03, 2020-12-04, 2021-0~
## $ state <chr> "IL", "ME", "NH", "IN", "CA", "GU", "CT", "WI", "NV", "~
## $ tot_cases <dbl> 1130917, 3910, 2518, 367338, 3409079, 0, 267337, 98440,~
## $ conf_cases <dbl> 1130917, 3497, NA, NA, 3285871, NA, 250915, 92712, NA, ~
## $ prob_cases <dbl> 0, 413, NA, NA, 123208, NA, 16422, 5728, NA, 105447, NA~
## $ new_cases <dbl> 2304, 22, 89, 7899, 18703, 0, 0, 1502, 128, 199, 0, 394~
## $ pnew_case <dbl> 0, 2, 0, 0, 892, NA, 0, 94, 0, 47, NA, 5, 102, NA, 0, 0~
## $ tot_deaths <dbl> 21336, 123, 86, 7031, 49603, 0, 7381, 1237, 5586, 21047~
## $ conf_death <dbl> 19306, 122, NA, 6746, 49603, NA, 6049, 1228, NA, 19789,~
## $ prob_death <dbl> 2030, 1, NA, 285, 0, NA, 1332, 9, NA, 1258, NA, NA, 0, ~
## $ new_deaths <dbl> 63, 2, 2, 91, 494, 0, 0, 8, 0, 6, 0, 32, 60, 6, 2, 39, ~
## $ pnew_death <dbl> 16, 0, 0, 1, 0, NA, 0, 0, 0, 0, NA, 0, 0, NA, 0, 7, 0, ~
## $ created_at <chr> "02/03/2021 02:55:58 PM", "07/31/2020 02:35:06 PM", "05~
## $ consent_cases <chr> "Agree", "Agree", "Not agree", "Not agree", "Agree", "N~
## $ consent_deaths <chr> "Agree", "Agree", "Not agree", "Agree", "Agree", "Not a~
##
## No file has been downloaded, will use existing file: ./RInputFiles/Coronavirus/CDC_h_downloaded_210801.csv
##
## -- Column specification --------------------------------------------------------
## cols(
## .default = col_double(),
## state = col_character(),
## date = col_date(format = ""),
## geocoded_state = col_logical()
## )
## i Use `spec()` for the full column specifications.
##
## *** File has been checked for uniqueness by: state date
##
##
## Checking for similarity of: column names
## In reference but not in current:
## In current but not in reference:
##
## Checking for similarity of: date
## In reference but not in current: 0
## In current but not in reference: 28
##
## Checking for similarity of: state
## In reference but not in current:
## In current but not in reference:
##
##
## ***Differences of at least 5 and at least 5%
##
## date name newValue refValue absDelta pctDelta
## 1 2021-07-02 hosp_ped 662 597 65 0.10325655
## 2 2021-07-03 hosp_ped 638 597 41 0.06639676
##
##
## ***Differences of at least 0 and at least 0.1%
##
## state name newValue refValue absDelta pctDelta
## 1 AL inp 523814 518483 5331 0.010229330
## 2 TN inp 558512 559654 1142 0.002042631
## 3 NM inp 137802 137991 189 0.001370593
## 4 NH hosp_ped 271 361 90 0.284810127
## 5 ME hosp_ped 452 509 57 0.118626431
## 6 KY hosp_ped 5518 5308 210 0.038795492
## 7 MA hosp_ped 5015 5201 186 0.036413469
## 8 AR hosp_ped 5977 5840 137 0.023186934
## 9 TN hosp_ped 7924 8102 178 0.022213902
## 10 DE hosp_ped 1647 1683 36 0.021621622
## 11 AL hosp_ped 7711 7555 156 0.020437574
## 12 WV hosp_ped 2226 2269 43 0.019132369
## 13 KS hosp_ped 1711 1679 32 0.018879056
## 14 NV hosp_ped 1999 2037 38 0.018830525
## 15 AZ hosp_ped 11435 11266 169 0.014889212
## 16 VA hosp_ped 6604 6513 91 0.013875124
## 17 IN hosp_ped 6913 6826 87 0.012664677
## 18 MS hosp_ped 3727 3686 41 0.011061648
## 19 MO hosp_ped 15406 15241 165 0.010767775
## 20 SC hosp_ped 2706 2679 27 0.010027855
## 21 PA hosp_ped 19857 20010 153 0.007675521
## 22 WA hosp_ped 4288 4263 25 0.005847269
## 23 NM hosp_ped 3125 3107 18 0.005776637
## 24 IA hosp_ped 2275 2287 12 0.005260851
## 25 CO hosp_ped 9355 9401 46 0.004905097
## 26 NJ hosp_ped 9108 9142 34 0.003726027
## 27 OH hosp_ped 25500 25406 94 0.003693081
## 28 IL hosp_ped 19711 19644 67 0.003404904
## 29 GA hosp_ped 21902 21973 71 0.003236467
## 30 MT hosp_ped 1022 1025 3 0.002931119
## 31 PR hosp_ped 11353 11380 27 0.002375401
## 32 CA hosp_ped 30719 30667 52 0.001694197
## 33 LA hosp_ped 3174 3179 5 0.001574059
## 34 TX hosp_ped 38680 38739 59 0.001524174
## 35 FL hosp_ped 54840 54921 81 0.001475934
## 36 HI hosp_ped 720 721 1 0.001387925
## 37 NC hosp_ped 10619 10606 13 0.001224971
## 38 AL hosp_adult 443621 439848 3773 0.008541330
## 39 TN hosp_adult 494022 494969 947 0.001915083
## 40 NM hosp_adult 112634 112842 208 0.001844986
## 41 ME hosp_adult 37173 37121 52 0.001399844
## 42 WV hosp_adult 126618 126444 174 0.001375157
## 43 KY hosp_adult 299353 299757 404 0.001348667
## 44 NH hosp_adult 39064 39014 50 0.001280771
## 45 CA hosp_adult 2422197 2425080 2883 0.001189534
##
##
##
## Raw file for cdcHosp:
## Rows: 27,682
## Columns: 99
## $ state <chr> ~
## $ date <date> ~
## $ critical_staffing_shortage_today_yes <dbl> ~
## $ critical_staffing_shortage_today_no <dbl> ~
## $ critical_staffing_shortage_today_not_reported <dbl> ~
## $ critical_staffing_shortage_anticipated_within_week_yes <dbl> ~
## $ critical_staffing_shortage_anticipated_within_week_no <dbl> ~
## $ critical_staffing_shortage_anticipated_within_week_not_reported <dbl> ~
## $ hospital_onset_covid <dbl> ~
## $ hospital_onset_covid_coverage <dbl> ~
## $ inpatient_beds <dbl> ~
## $ inpatient_beds_coverage <dbl> ~
## $ inpatient_beds_used <dbl> ~
## $ inpatient_beds_used_coverage <dbl> ~
## $ inp <dbl> ~
## $ inpatient_beds_used_covid_coverage <dbl> ~
## $ previous_day_admission_adult_covid_confirmed <dbl> ~
## $ previous_day_admission_adult_covid_confirmed_coverage <dbl> ~
## $ previous_day_admission_adult_covid_suspected <dbl> ~
## $ previous_day_admission_adult_covid_suspected_coverage <dbl> ~
## $ previous_day_admission_pediatric_covid_confirmed <dbl> ~
## $ previous_day_admission_pediatric_covid_confirmed_coverage <dbl> ~
## $ previous_day_admission_pediatric_covid_suspected <dbl> ~
## $ previous_day_admission_pediatric_covid_suspected_coverage <dbl> ~
## $ staffed_adult_icu_bed_occupancy <dbl> ~
## $ staffed_adult_icu_bed_occupancy_coverage <dbl> ~
## $ staffed_icu_adult_patients_confirmed_and_suspected_covid <dbl> ~
## $ staffed_icu_adult_patients_confirmed_and_suspected_covid_coverage <dbl> ~
## $ staffed_icu_adult_patients_confirmed_covid <dbl> ~
## $ staffed_icu_adult_patients_confirmed_covid_coverage <dbl> ~
## $ hosp_adult <dbl> ~
## $ total_adult_patients_hospitalized_confirmed_and_suspected_covid_coverage <dbl> ~
## $ total_adult_patients_hospitalized_confirmed_covid <dbl> ~
## $ total_adult_patients_hospitalized_confirmed_covid_coverage <dbl> ~
## $ hosp_ped <dbl> ~
## $ total_pediatric_patients_hospitalized_confirmed_and_suspected_covid_coverage <dbl> ~
## $ total_pediatric_patients_hospitalized_confirmed_covid <dbl> ~
## $ total_pediatric_patients_hospitalized_confirmed_covid_coverage <dbl> ~
## $ total_staffed_adult_icu_beds <dbl> ~
## $ total_staffed_adult_icu_beds_coverage <dbl> ~
## $ inpatient_beds_utilization <dbl> ~
## $ inpatient_beds_utilization_coverage <dbl> ~
## $ inpatient_beds_utilization_numerator <dbl> ~
## $ inpatient_beds_utilization_denominator <dbl> ~
## $ percent_of_inpatients_with_covid <dbl> ~
## $ percent_of_inpatients_with_covid_coverage <dbl> ~
## $ percent_of_inpatients_with_covid_numerator <dbl> ~
## $ percent_of_inpatients_with_covid_denominator <dbl> ~
## $ inpatient_bed_covid_utilization <dbl> ~
## $ inpatient_bed_covid_utilization_coverage <dbl> ~
## $ inpatient_bed_covid_utilization_numerator <dbl> ~
## $ inpatient_bed_covid_utilization_denominator <dbl> ~
## $ adult_icu_bed_covid_utilization <dbl> ~
## $ adult_icu_bed_covid_utilization_coverage <dbl> ~
## $ adult_icu_bed_covid_utilization_numerator <dbl> ~
## $ adult_icu_bed_covid_utilization_denominator <dbl> ~
## $ adult_icu_bed_utilization <dbl> ~
## $ adult_icu_bed_utilization_coverage <dbl> ~
## $ adult_icu_bed_utilization_numerator <dbl> ~
## $ adult_icu_bed_utilization_denominator <dbl> ~
## $ geocoded_state <lgl> ~
## $ `previous_day_admission_adult_covid_confirmed_18-19` <dbl> ~
## $ `previous_day_admission_adult_covid_confirmed_18-19_coverage` <dbl> ~
## $ `previous_day_admission_adult_covid_confirmed_20-29` <dbl> ~
## $ `previous_day_admission_adult_covid_confirmed_20-29_coverage` <dbl> ~
## $ `previous_day_admission_adult_covid_confirmed_30-39` <dbl> ~
## $ `previous_day_admission_adult_covid_confirmed_30-39_coverage` <dbl> ~
## $ `previous_day_admission_adult_covid_confirmed_40-49` <dbl> ~
## $ `previous_day_admission_adult_covid_confirmed_40-49_coverage` <dbl> ~
## $ `previous_day_admission_adult_covid_confirmed_50-59` <dbl> ~
## $ `previous_day_admission_adult_covid_confirmed_50-59_coverage` <dbl> ~
## $ `previous_day_admission_adult_covid_confirmed_60-69` <dbl> ~
## $ `previous_day_admission_adult_covid_confirmed_60-69_coverage` <dbl> ~
## $ `previous_day_admission_adult_covid_confirmed_70-79` <dbl> ~
## $ `previous_day_admission_adult_covid_confirmed_70-79_coverage` <dbl> ~
## $ `previous_day_admission_adult_covid_confirmed_80+` <dbl> ~
## $ `previous_day_admission_adult_covid_confirmed_80+_coverage` <dbl> ~
## $ previous_day_admission_adult_covid_confirmed_unknown <dbl> ~
## $ previous_day_admission_adult_covid_confirmed_unknown_coverage <dbl> ~
## $ `previous_day_admission_adult_covid_suspected_18-19` <dbl> ~
## $ `previous_day_admission_adult_covid_suspected_18-19_coverage` <dbl> ~
## $ `previous_day_admission_adult_covid_suspected_20-29` <dbl> ~
## $ `previous_day_admission_adult_covid_suspected_20-29_coverage` <dbl> ~
## $ `previous_day_admission_adult_covid_suspected_30-39` <dbl> ~
## $ `previous_day_admission_adult_covid_suspected_30-39_coverage` <dbl> ~
## $ `previous_day_admission_adult_covid_suspected_40-49` <dbl> ~
## $ `previous_day_admission_adult_covid_suspected_40-49_coverage` <dbl> ~
## $ `previous_day_admission_adult_covid_suspected_50-59` <dbl> ~
## $ `previous_day_admission_adult_covid_suspected_50-59_coverage` <dbl> ~
## $ `previous_day_admission_adult_covid_suspected_60-69` <dbl> ~
## $ `previous_day_admission_adult_covid_suspected_60-69_coverage` <dbl> ~
## $ `previous_day_admission_adult_covid_suspected_70-79` <dbl> ~
## $ `previous_day_admission_adult_covid_suspected_70-79_coverage` <dbl> ~
## $ `previous_day_admission_adult_covid_suspected_80+` <dbl> ~
## $ `previous_day_admission_adult_covid_suspected_80+_coverage` <dbl> ~
## $ previous_day_admission_adult_covid_suspected_unknown <dbl> ~
## $ previous_day_admission_adult_covid_suspected_unknown_coverage <dbl> ~
## $ deaths_covid <dbl> ~
## $ deaths_covid_coverage <dbl> ~
##
## No file has been downloaded, will use existing file: ./RInputFiles/Coronavirus/vaxData_downloaded_210801.csv
##
## -- Column specification --------------------------------------------------------
## cols(
## .default = col_double(),
## Date = col_character(),
## Location = col_character()
## )
## i Use `spec()` for the full column specifications.
##
## *** File has been checked for uniqueness by: state date
##
##
## Checking for similarity of: column names
## In reference but not in current:
## In current but not in reference:
##
## Checking for similarity of: date
## In reference but not in current: 0
## In current but not in reference: 4
##
## Checking for similarity of: state
## In reference but not in current:
## In current but not in reference:
##
##
## ***Differences of at least 1 and at least 1%
##
## [1] date name newValue refValue absDelta pctDelta
## <0 rows> (or 0-length row.names)
##
##
## ***Differences of at least 0 and at least 0.1%
##
## [1] state name newValue refValue absDelta pctDelta
## <0 rows> (or 0-length row.names)
##
##
##
## Raw file for vax:
## Rows: 14,918
## Columns: 69
## $ date <date> 2021-07-31, 2021-07-31, 2021-0~
## $ MMWR_week <dbl> 30, 30, 30, 30, 30, 30, 30, 30,~
## $ state <chr> "AK", "NM", "PR", "RP", "MS", "~
## $ Distributed <dbl> 854805, 2449685, 4266370, 28650~
## $ Distributed_Janssen <dbl> 59300, 138500, 190000, 3800, 16~
## $ Distributed_Moderna <dbl> 366220, 1066860, 1853400, 20800~
## $ Distributed_Pfizer <dbl> 429285, 1244325, 2222970, 4050,~
## $ Distributed_Unk_Manuf <dbl> 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0~
## $ Dist_Per_100K <dbl> 116849, 116828, 133587, 159993,~
## $ Distributed_Per_100k_12Plus <dbl> 140390, 137051, 149787, 187353,~
## $ Distributed_Per_100k_18Plus <dbl> 154979, 151123, 162779, 205421,~
## $ Distributed_Per_100k_65Plus <dbl> 933315, 648741, 785808, 944298,~
## $ vxa <dbl> 697440, 2487536, 3975244, 26286~
## $ Administered_12Plus <dbl> 695366, 2487278, 3973905, 26286~
## $ Administered_18Plus <dbl> 653874, 2330829, 3705211, 25597~
## $ Administered_65Plus <dbl> 143058, 664378, 1048492, 3120, ~
## $ Administered_Janssen <dbl> 28437, 87616, 114212, 2145, 637~
## $ Administered_Moderna <dbl> 289116, 1081538, 1691040, 23441~
## $ Administered_Pfizer <dbl> 379706, 1313894, 2169642, 700, ~
## $ Administered_Unk_Manuf <dbl> 181, 4488, 350, 0, 1047, 727, 0~
## $ Administered_Fed_LTC <dbl> 6640, 39710, 74284, 0, 54224, 1~
## $ Administered_Fed_LTC_Residents <dbl> 2078, 11847, 11431, 0, 26288, 8~
## $ Administered_Fed_LTC_Staff <dbl> 1378, 12139, 10950, 0, 12915, 5~
## $ Administered_Fed_LTC_Unk <dbl> 3184, 15724, 51903, 0, 15021, 3~
## $ Administered_Fed_LTC_Dose1 <dbl> 4300, 24065, 53094, 0, 31843, 1~
## $ Administered_Fed_LTC_Dose1_Residents <dbl> 1383, 6414, 7925, 0, 14433, 507~
## $ Administered_Fed_LTC_Dose1_Staff <dbl> 956, 6649, 7461, 0, 7685, 36183~
## $ Administered_Fed_LTC_Dose1_Unk <dbl> 1961, 11002, 37708, 0, 9725, 29~
## $ Admin_Per_100k <dbl> 95338, 118633, 124472, 146792, ~
## $ Admin_Per_100k_12Plus <dbl> 114205, 139154, 139519, 171894,~
## $ Admin_Per_100k_18Plus <dbl> 118550, 143790, 141368, 183531,~
## $ Admin_Per_100k_65Plus <dbl> 156197, 175945, 193118, 102835,~
## $ Recip_Administered <dbl> 692140, 2511859, 4003254, 26519~
## $ Administered_Dose1_Recip <dbl> 376882, 1374231, 2197391, 15199~
## $ Administered_Dose1_Pop_Pct <dbl> 51.5, 65.5, 68.8, 84.9, 39.8, 5~
## $ Administered_Dose1_Recip_12Plus <dbl> 375603, 1373997, 2196318, 15199~
## $ Administered_Dose1_Recip_12PlusPop_Pct <dbl> 61.7, 76.9, 77.1, 99.4, 46.9, 6~
## $ Administered_Dose1_Recip_18Plus <dbl> 352303, 1282733, 2045507, 14508~
## $ Administered_Dose1_Recip_18PlusPop_Pct <dbl> 63.9, 79.1, 78.0, 99.9, 50.0, 6~
## $ Administered_Dose1_Recip_65Plus <dbl> 75867, 359328, 564728, 1707, 38~
## $ Administered_Dose1_Recip_65PlusPop_Pct <dbl> 82.8, 95.2, 99.9, 56.3, 78.6, 9~
## $ vxc <dbl> 333092, 1198386, 1911719, 13461~
## $ vxcpoppct <dbl> 45.5, 57.2, 59.9, 75.2, 34.5, 5~
## $ Series_Complete_12Plus <dbl> 332299, 1198314, 1911408, 13461~
## $ Series_Complete_12PlusPop_Pct <dbl> 54.6, 67.0, 67.1, 88.0, 40.7, 6~
## $ vxcgte18 <dbl> 314089, 1126808, 1790751, 13461~
## $ vxcgte18pct <dbl> 56.9, 69.5, 68.3, 96.5, 44.0, 6~
## $ vxcgte65 <dbl> 71390, 324959, 506358, 1671, 35~
## $ vxcgte65pct <dbl> 77.9, 86.1, 93.3, 55.1, 72.7, 8~
## $ Series_Complete_Janssen <dbl> 26386, 86064, 113821, 2148, 627~
## $ Series_Complete_Moderna <dbl> 133838, 492367, 784508, 11283, ~
## $ Series_Complete_Pfizer <dbl> 172824, 618609, 1013352, 30, 52~
## $ Series_Complete_Unk_Manuf <dbl> 44, 1346, 38, 0, 138, 318, 0, 1~
## $ Series_Complete_Janssen_12Plus <dbl> 26384, 86052, 113778, 2148, 627~
## $ Series_Complete_Moderna_12Plus <dbl> 133834, 492349, 784456, 11283, ~
## $ Series_Complete_Pfizer_12Plus <dbl> 172037, 618567, 1013136, 30, 52~
## $ Series_Complete_Unk_Manuf_12Plus <dbl> 44, 1346, 38, 0, 138, 318, 0, 1~
## $ Series_Complete_Janssen_18Plus <dbl> 26261, 85937, 113673, 2148, 626~
## $ Series_Complete_Moderna_18Plus <dbl> 133469, 492021, 784182, 11283, ~
## $ Series_Complete_Pfizer_18Plus <dbl> 154318, 547516, 892859, 30, 495~
## $ Series_Complete_Unk_Manuf_18Plus <dbl> 41, 1334, 37, 0, 133, 309, 0, 1~
## $ Series_Complete_Janssen_65Plus <dbl> 2638, 18271, 19965, 212, 15374,~
## $ Series_Complete_Moderna_65Plus <dbl> 40125, 151102, 257623, 1450, 18~
## $ Series_Complete_Pfizer_65Plus <dbl> 28605, 154857, 228764, 9, 15393~
## $ Series_Complete_Unk_Manuf_65Plus <dbl> 22, 729, 6, 0, 60, 135, 0, 734,~
## $ Series_Complete_FedLTC <dbl> 2320, 15515, 21185, 0, 22390, 6~
## $ Series_Complete_FedLTC_Residents <dbl> 676, 5246, 3503, 0, 11688, 3467~
## $ Series_Complete_FedLTC_Staff <dbl> 425, 5319, 3488, 0, 5176, 23209~
## $ Series_Complete_FedLTC_Unknown <dbl> 1219, 4950, 14194, 0, 5526, 782~
##
## Column sums before and after applying filtering rules:
## # A tibble: 3 x 6
## isType tot_cases tot_deaths new_cases new_deaths n
## <chr> <dbl> <dbl> <dbl> <dbl> <dbl>
## 1 before 8.21e+9 1.64e+8 3.49e+7 604596 32804
## 2 after 8.17e+9 1.63e+8 3.47e+7 601834 28356
## 3 pctchg 4.40e-3 3.96e-3 4.58e-3 0.00457 0.136
##
##
## Processed for cdcDaily:
## Rows: 28,356
## Columns: 6
## $ date <date> 2021-02-02, 2020-07-30, 2020-05-03, 2020-12-04, 2021-01-28~
## $ state <chr> "IL", "ME", "NH", "IN", "CA", "CT", "WI", "NV", "MI", "MI",~
## $ tot_cases <dbl> 1130917, 3910, 2518, 367338, 3409079, 267337, 98440, 324132~
## $ tot_deaths <dbl> 21336, 123, 86, 7031, 49603, 7381, 1237, 5586, 21047, 0, 11~
## $ new_cases <dbl> 2304, 22, 89, 7899, 18703, 0, 1502, 128, 199, 0, 394, 3436,~
## $ new_deaths <dbl> 63, 2, 2, 91, 494, 0, 8, 0, 6, 0, 32, 60, 6, 2, 39, 66, 0, ~
##
## Column sums before and after applying filtering rules:
## # A tibble: 3 x 5
## isType inp hosp_adult hosp_ped n
## <chr> <dbl> <dbl> <dbl> <dbl>
## 1 before 2.78e+7 2.19e+7 471723 27682
## 2 after 2.77e+7 2.18e+7 459822 26679
## 3 pctchg 5.58e-3 5.57e-3 0.0252 0.0362
##
##
## Processed for cdcHosp:
## Rows: 26,679
## Columns: 5
## $ date <date> 2020-07-22, 2020-07-20, 2020-07-19, 2020-07-18, 2020-07-18~
## $ state <chr> "IA", "IA", "ND", "IA", "ND", "TX", "OK", "CT", "ND", "NM",~
## $ inp <dbl> 0, 1, 46, 10, 33, 12003, 678, 215, 16, 119, 51, 19, 250, 14~
## $ hosp_adult <dbl> 0, 1, NA, 10, NA, 7999, 566, 115, NA, NA, NA, NA, NA, NA, N~
## $ hosp_ped <dbl> 0, 0, NA, 0, NA, 194, 9, 0, NA, NA, NA, NA, NA, NA, NA, NA,~
##
## Column sums before and after applying filtering rules:
## # A tibble: 3 x 9
## isType vxa vxc vxcpoppct vxcgte65 vxcgte65pct vxcgte18 vxcgte18pct
## <chr> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
## 1 before 8.19e+10 3.37e+10 302401. 1.10e+10 561791. 3.28e+10 373517.
## 2 after 3.89e+10 1.63e+10 255914. 5.34e+ 9 512134. 1.59e+10 320269.
## 3 pctchg 5.24e- 1 5.16e- 1 0.154 5.16e- 1 0.0884 5.16e- 1 0.143
## # ... with 1 more variable: n <dbl>
##
##
## Processed for vax:
## Rows: 11,730
## Columns: 9
## $ date <date> 2021-07-31, 2021-07-31, 2021-07-31, 2021-07-31, 2021-07-3~
## $ state <chr> "AK", "NM", "MS", "WI", "NY", "OK", "MD", "NH", "WV", "AL"~
## $ vxa <dbl> 697440, 2487536, 2150026, 6163565, 22950250, 3460262, 7213~
## $ vxc <dbl> 333092, 1198386, 1026837, 3015017, 11109858, 1593194, 3559~
## $ vxcpoppct <dbl> 45.5, 57.2, 34.5, 51.8, 57.1, 40.3, 58.9, 58.3, 39.0, 34.3~
## $ vxcgte65 <dbl> 71390, 324959, 353642, 895738, 2663975, 482309, 844122, 22~
## $ vxcgte65pct <dbl> 77.9, 86.1, 72.7, 88.1, 80.8, 75.9, 88.0, 87.4, 70.2, 69.5~
## $ vxcgte18 <dbl> 314089, 1126808, 1001545, 2875753, 10577357, 1533309, 3342~
## $ vxcgte18pct <dbl> 56.9, 69.5, 44.0, 63.1, 68.6, 51.0, 71.0, 68.2, 46.9, 43.1~
##
## Integrated per capita data file:
## Rows: 28,569
## Columns: 34
## $ date <date> 2020-01-01, 2020-01-01, 2020-01-01, 2020-01-01, 2020-01-0~
## $ state <chr> "AL", "HI", "IN", "LA", "MN", "MT", "NC", "TX", "AL", "HI"~
## $ tot_cases <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA~
## $ tot_deaths <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA~
## $ new_cases <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA~
## $ new_deaths <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA~
## $ inp <dbl> NA, 0, 0, NA, 0, 0, 0, 0, NA, 0, 0, NA, 0, 0, 0, 1877, 0, ~
## $ hosp_adult <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA~
## $ hosp_ped <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA~
## $ vxa <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA~
## $ vxc <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA~
## $ vxcpoppct <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA~
## $ vxcgte65 <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA~
## $ vxcgte65pct <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA~
## $ vxcgte18 <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA~
## $ vxcgte18pct <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA~
## $ tcpm <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA~
## $ tdpm <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA~
## $ cpm <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA~
## $ dpm <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA~
## $ hpm <dbl> NA, 0.0000, 0.0000, NA, 0.0000, 0.0000, 0.0000, 0.0000, NA~
## $ ahpm <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA~
## $ phpm <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA~
## $ vxapm <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA~
## $ vxcpm <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA~
## $ tcpm7 <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA~
## $ tdpm7 <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA~
## $ cpm7 <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA~
## $ dpm7 <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA~
## $ hpm7 <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA~
## $ ahpm7 <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA~
## $ phpm7 <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA~
## $ vxapm7 <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA~
## $ vxcpm7 <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA~
## Warning in showSRID(uprojargs, format = "PROJ", multiline = "NO", prefer_proj =
## prefer_proj): Discarded datum unknown in CRS definition
all.equal(names(cdc_daily_210801_test), names(readFromRDS("cdc_daily_210801")))
## [1] TRUE
sapply(names(cdc_daily_210801_test), FUN=function(x)
identical(cdc_daily_210801_test[[x]], readFromRDS("cdc_daily_210801")[[x]])
)
## stateData dfRaw dfProcess dfPerCapita useClusters plotDataList
## TRUE TRUE TRUE TRUE TRUE FALSE
sapply(names(cdc_daily_210801_test$plotDataList), FUN=function(x)
identical(cdc_daily_210801_test$plotDataList[[x]], readFromRDS("cdc_daily_210801")$plotDataList[[x]])
)
## dfFull dfAgg plotClusters summaryPlots detPlots
## TRUE TRUE TRUE FALSE FALSE
As expected, all data elements are identical. Plot environments change with each creation, so the plot objects are not identical.
The latest data are downloaded and processed, with caching to avoid multiple file downloads:
readList <- list("cdcDaily"="./RInputFiles/Coronavirus/CDC_dc_downloaded_210804.csv",
"cdcHosp"="./RInputFiles/Coronavirus/CDC_h_downloaded_210804.csv",
"vax"="./RInputFiles/Coronavirus/vaxData_downloaded_210804.csv"
)
compareList <- list("cdcDaily"=readFromRDS("cdc_daily_210708")$dfRaw$cdcDaily,
"cdcHosp"=readFromRDS("cdc_daily_210708")$dfRaw$cdcHosp,
"vax"=readFromRDS("cdc_daily_210728_vaxonly")$dfRaw$vax
)
cdc_daily_210804 <- readRunCDCDaily(thruLabel="Aug 3, 2021",
downloadTo=lapply(readList, FUN=function(x) if(file.exists(x)) NA else x),
readFrom=readList,
compareFile=compareList,
writeLog=NULL,
useClusters=readFromRDS("cdc_daily_210528")$useClusters,
weightedMeanAggs=c("tcpm7", "tdpm7", "cpm7", "dpm7", "hpm7",
"vxcpm7", "vxcgte65pct"
),
skipAssessmentPlots=FALSE,
brewPalette="Paired"
)
##
## -- Column specification --------------------------------------------------------
## cols(
## submission_date = col_character(),
## state = col_character(),
## tot_cases = col_double(),
## conf_cases = col_double(),
## prob_cases = col_double(),
## new_case = col_double(),
## pnew_case = col_double(),
## tot_death = col_double(),
## conf_death = col_double(),
## prob_death = col_double(),
## new_death = col_double(),
## pnew_death = col_double(),
## created_at = col_character(),
## consent_cases = col_character(),
## consent_deaths = col_character()
## )
##
## *** File has been checked for uniqueness by: state date
##
##
## Checking for similarity of: column names
## In reference but not in current:
## In current but not in reference:
##
## Checking for similarity of: date
## In reference but not in current: 0
## In current but not in reference: 28
##
## Checking for similarity of: state
## In reference but not in current:
## In current but not in reference:
##
##
## ***Differences of at least 5 and at least 5%
##
## date name newValue refValue absDelta pctDelta
## 1 2020-02-02 tot_deaths 143 152 9 0.06101695
## 2 2020-02-03 tot_deaths 143 152 9 0.06101695
## 3 2020-02-04 tot_deaths 143 152 9 0.06101695
## 4 2020-02-05 tot_deaths 143 152 9 0.06101695
## 5 2020-02-06 tot_deaths 143 152 9 0.06101695
## 6 2020-02-07 tot_deaths 143 152 9 0.06101695
## 7 2020-02-08 tot_deaths 144 153 9 0.06060606
## 8 2020-02-09 tot_deaths 144 153 9 0.06060606
## 9 2020-02-10 tot_deaths 144 153 9 0.06060606
## 10 2020-02-11 tot_deaths 144 153 9 0.06060606
## 11 2020-02-12 tot_deaths 144 153 9 0.06060606
## 12 2020-02-13 tot_deaths 144 153 9 0.06060606
## 13 2020-02-14 tot_deaths 144 153 9 0.06060606
## 14 2020-02-15 tot_deaths 144 153 9 0.06060606
## 15 2020-02-16 tot_deaths 144 153 9 0.06060606
## 16 2020-02-17 tot_deaths 144 153 9 0.06060606
## 17 2020-02-18 tot_deaths 144 153 9 0.06060606
## 18 2020-02-19 tot_deaths 145 154 9 0.06020067
## 19 2020-02-20 tot_deaths 145 154 9 0.06020067
## 20 2020-02-21 tot_deaths 145 154 9 0.06020067
## 21 2020-02-22 tot_deaths 145 154 9 0.06020067
## 22 2020-02-23 tot_deaths 145 154 9 0.06020067
## 23 2020-02-24 tot_deaths 145 154 9 0.06020067
## 24 2020-02-25 tot_deaths 145 154 9 0.06020067
## 25 2020-02-26 tot_deaths 145 154 9 0.06020067
## 26 2020-02-27 tot_deaths 146 155 9 0.05980066
## 27 2020-02-28 tot_deaths 146 155 9 0.05980066
## 28 2020-02-29 tot_deaths 147 156 9 0.05940594
## 29 2020-03-01 tot_deaths 147 156 9 0.05940594
## 30 2020-03-02 tot_deaths 153 162 9 0.05714286
## 31 2020-03-03 tot_deaths 156 165 9 0.05607477
## 32 2020-03-04 tot_deaths 158 167 9 0.05538462
## 33 2020-03-05 tot_deaths 160 169 9 0.05471125
## 34 2020-03-06 tot_deaths 163 172 9 0.05373134
## 35 2020-03-07 tot_deaths 168 177 9 0.05217391
## 36 2020-03-08 tot_deaths 173 182 9 0.05070423
## 37 2020-02-02 tot_cases 510 612 102 0.18181818
## 38 2020-02-03 tot_cases 542 644 102 0.17200675
## 39 2020-02-04 tot_cases 550 652 102 0.16971714
## 40 2020-02-05 tot_cases 555 657 102 0.16831683
## 41 2020-02-06 tot_cases 557 658 101 0.16625514
## 42 2020-02-07 tot_cases 562 663 101 0.16489796
## 43 2020-02-08 tot_cases 570 670 100 0.16129032
## 44 2020-02-09 tot_cases 605 705 100 0.15267176
## 45 2020-02-10 tot_cases 614 713 99 0.14920874
## 46 2020-02-11 tot_cases 625 721 96 0.14264487
## 47 2020-02-12 tot_cases 635 731 96 0.14055637
## 48 2020-02-13 tot_cases 641 736 95 0.13798112
## 49 2020-02-14 tot_cases 649 743 94 0.13505747
## 50 2020-02-15 tot_cases 654 748 94 0.13409415
## 51 2020-02-16 tot_cases 667 758 91 0.12771930
## 52 2020-02-17 tot_cases 685 776 91 0.12457221
## 53 2020-02-18 tot_cases 692 783 91 0.12338983
## 54 2020-02-19 tot_cases 709 799 90 0.11936340
## 55 2020-02-20 tot_cases 723 811 88 0.11473272
## 56 2020-02-21 tot_cases 742 829 87 0.11075748
## 57 2020-02-22 tot_cases 768 855 87 0.10720887
## 58 2020-02-23 tot_cases 792 877 85 0.10185740
## 59 2020-02-24 tot_cases 811 896 85 0.09958992
## 60 2020-02-25 tot_cases 835 920 85 0.09686610
## 61 2020-02-26 tot_cases 879 963 84 0.09120521
## 62 2020-02-27 tot_cases 916 998 82 0.08568443
## 63 2020-02-28 tot_cases 968 1049 81 0.08031730
## 64 2020-02-29 tot_cases 1005 1087 82 0.07839388
## 65 2020-03-01 tot_cases 1094 1177 83 0.07309555
## 66 2020-03-02 tot_cases 1172 1254 82 0.06760099
## 67 2020-03-03 tot_cases 1343 1424 81 0.05854716
## 68 2020-03-04 tot_cases 1482 1565 83 0.05447982
## 69 2021-07-05 new_deaths 106 37 69 0.96503497
## 70 2021-07-04 new_deaths 101 38 63 0.90647482
## 71 2021-01-18 new_deaths 2674 1130 1544 0.81177708
## 72 2021-07-03 new_deaths 142 86 56 0.49122807
## 73 2021-01-19 new_deaths 3036 4578 1542 0.40504334
## 74 2020-12-26 new_deaths 2248 3093 845 0.31642015
## 75 2020-12-24 new_deaths 3274 2463 811 0.28272616
## 76 2021-06-27 new_deaths 139 105 34 0.27868852
## 77 2021-06-26 new_deaths 175 142 33 0.20820189
## 78 2021-06-20 new_deaths 177 145 32 0.19875776
## 79 2021-06-19 new_deaths 180 154 26 0.15568862
## 80 2021-06-28 new_deaths 193 170 23 0.12672176
## 81 2021-06-24 new_deaths 287 258 29 0.10642202
## 82 2021-06-17 new_deaths 334 302 32 0.10062893
## 83 2021-06-23 new_deaths 310 281 29 0.09813875
## 84 2021-06-25 new_deaths 300 273 27 0.09424084
## 85 2021-06-22 new_deaths 283 258 25 0.09242144
## 86 2021-06-18 new_deaths 210 192 18 0.08955224
## 87 2021-06-13 new_deaths 200 184 16 0.08333333
## 88 2021-05-30 new_deaths 237 220 17 0.07439825
## 89 2020-03-21 new_deaths 114 107 7 0.06334842
## 90 2021-06-11 new_deaths 326 306 20 0.06329114
## 91 2021-06-16 new_deaths 310 293 17 0.05638474
## 92 2021-06-15 new_deaths 336 319 17 0.05190840
## 93 2020-02-02 new_cases 1 557 556 1.99283154
## 94 2021-07-05 new_cases 11586 3575 8011 1.05679045
## 95 2021-07-04 new_cases 12813 4156 8657 1.02033119
## 96 2021-07-03 new_cases 14988 5887 9101 0.87195210
## 97 2021-06-10 new_cases 16732 12363 4369 0.30032652
## 98 2021-01-18 new_cases 138860 107646 31214 0.25325144
## 99 2021-01-19 new_cases 145017 176292 31275 0.19467242
## 100 2021-07-02 new_cases 16845 14183 2662 0.17158695
## 101 2021-06-20 new_cases 9238 7787 1451 0.17045521
## 102 2020-12-24 new_cases 222830 195402 27428 0.13116165
## 103 2021-06-01 new_cases 9691 8540 1151 0.12626844
## 104 2021-01-29 new_cases 156346 139722 16624 0.11229853
## 105 2020-12-26 new_cases 151877 169350 17473 0.10878911
## 106 2021-06-30 new_cases 17308 15526 1782 0.10854602
## 107 2021-06-28 new_cases 9695 8701 994 0.10806697
## 108 2021-06-09 new_cases 19405 21526 2121 0.10363783
## 109 2021-01-09 new_cases 249814 226455 23359 0.09809162
## 110 2021-01-30 new_cases 137320 150808 13488 0.09362506
## 111 2021-07-01 new_cases 18738 17149 1589 0.08855574
## 112 2021-06-08 new_cases 14357 15667 1310 0.08726352
## 113 2021-06-29 new_cases 16174 15051 1123 0.07192954
## 114 2021-06-06 new_cases 12103 11304 799 0.06827018
## 115 2020-07-14 new_cases 65688 61818 3870 0.06070303
## 116 2021-01-08 new_cases 295299 312357 17058 0.05614361
## 117 2021-05-24 new_cases 15656 14828 828 0.05432358
## 118 2021-05-31 new_cases 9193 9700 507 0.05367067
## 119 2021-05-03 new_cases 33241 31601 1640 0.05058450
## 120 2020-07-15 new_cases 70325 73939 3614 0.05010259
##
##
## ***Differences of at least 0 and at least 0.1%
##
## state name newValue refValue absDelta pctDelta
## 1 IN tot_deaths 3407157 3378244 28913 0.008522120
## 2 SC tot_deaths 2291589 2305862 14273 0.006209093
## 3 CA tot_deaths 14183041 14129523 53518 0.003780512
## 4 NC tot_deaths 3073917 3062861 11056 0.003603194
## 5 MS tot_deaths 1998075 1991323 6752 0.003384972
## 6 KY tot_deaths 1634463 1630052 4411 0.002702392
## 7 AL tot_deaths 2743934 2738028 5906 0.002154703
## 8 RI tot_deaths 749883 751479 1596 0.002126070
## 9 NM tot_deaths 1001515 999916 1599 0.001597857
## 10 CA tot_cases 865747767 837321729 28426038 0.033382123
## 11 AL tot_cases 132184325 131406619 777706 0.005900855
## 12 SC tot_cases 129358076 129977727 619651 0.004778754
## 13 RI tot_cases 32450790 32591078 140288 0.004313775
## 14 MI tot_cases 214132223 214386719 254496 0.001187793
## 15 MS tot_cases 77187328 77104046 83282 0.001079542
## 16 MS new_deaths 7432 7332 100 0.013546464
## 17 NM new_deaths 4382 4344 38 0.008709603
## 18 CA new_deaths 63517 62992 525 0.008299805
## 19 AL new_deaths 11454 11360 94 0.008240554
## 20 KY new_deaths 7285 7229 56 0.007716687
## 21 NC new_deaths 13517 13434 83 0.006159326
## 22 MI new_deaths 21076 20995 81 0.003850633
## 23 IN new_deaths 13914 13863 51 0.003672103
## 24 TX new_deaths 51507 51349 158 0.003072256
## 25 TN new_deaths 12611 12576 35 0.002779211
## 26 WA new_deaths 5954 5939 15 0.002522492
## 27 RI new_deaths 2736 2730 6 0.002195390
## 28 UT new_deaths 2371 2368 3 0.001266090
## 29 CA new_cases 3880232 3713944 166288 0.043793560
## 30 AL new_cases 555727 552325 3402 0.006140506
## 31 VI new_cases 3932 3916 16 0.004077472
## 32 MS new_cases 323003 321780 1223 0.003793524
## 33 LA new_cases 483605 482096 1509 0.003125191
## 34 NV new_cases 335771 334763 1008 0.003006559
## 35 FL new_cases 2344516 2337613 6903 0.002948659
## 36 WY new_cases 62592 62445 147 0.002351304
## 37 UT new_cases 416971 416110 861 0.002067026
## 38 KS new_cases 319154 318515 639 0.002004175
## 39 WA new_cases 453368 452483 885 0.001953964
## 40 AK new_cases 68595 68478 117 0.001707120
## 41 MI new_cases 1002081 1000375 1706 0.001703908
## 42 OR new_cases 209377 209035 342 0.001634752
## 43 NC new_cases 1015407 1014359 1048 0.001032631
##
##
##
## Raw file for cdcDaily:
## Rows: 33,540
## Columns: 15
## $ date <date> 2021-02-12, 2020-07-28, 2020-08-22, 2020-10-22, 2020-0~
## $ state <chr> "UT", "MP", "AR", "MP", "AS", "HI", "AK", "TX", "NYC", ~
## $ tot_cases <dbl> 359641, 40, 56199, 88, 0, 661, 71521, 1867163, 948436, ~
## $ conf_cases <dbl> 359641, 40, NA, 88, NA, NA, NA, NA, 782257, NA, 106, NA~
## $ prob_cases <dbl> 0, 0, NA, 0, NA, NA, NA, NA, 166179, NA, 0, NA, 0, 4003~
## $ new_cases <dbl> 1060, 0, 547, 0, 0, 8, 235, 24010, 394, 18811, 0, 0, 11~
## $ pnew_case <dbl> 0, 0, 0, 0, 0, 0, 0, 4196, 95, 3202, 0, 0, 0, 197, 0, 0~
## $ tot_deaths <dbl> 1785, 2, 674, 2, 0, 17, 377, 33124, 33203, 23357, 2, 0,~
## $ conf_death <dbl> 1729, 2, NA, 2, NA, NA, NA, NA, 28130, NA, 2, NA, NA, 1~
## $ prob_death <dbl> 56, 0, NA, 0, NA, NA, NA, NA, 5073, NA, 0, NA, NA, 350,~
## $ new_deaths <dbl> 11, 0, 11, 0, 0, 0, 0, 345, 6, 190, 0, 0, 7, 8, 5, 0, 1~
## $ pnew_death <dbl> 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, NA, 0, 0, 0, 0, 0, ~
## $ created_at <chr> "02/13/2021 02:50:08 PM", "07/29/2020 02:34:46 PM", "08~
## $ consent_cases <chr> "Agree", "Agree", "Not agree", "Agree", NA, "Not agree"~
## $ consent_deaths <chr> "Agree", "Agree", "Not agree", "Agree", NA, "Not agree"~
##
## -- Column specification --------------------------------------------------------
## cols(
## .default = col_double(),
## state = col_character(),
## date = col_date(format = ""),
## geocoded_state = col_logical()
## )
## i Use `spec()` for the full column specifications.
##
## *** File has been checked for uniqueness by: state date
##
##
## Checking for similarity of: column names
## In reference but not in current:
## In current but not in reference:
##
## Checking for similarity of: date
## In reference but not in current: 0
## In current but not in reference: 28
##
## Checking for similarity of: state
## In reference but not in current:
## In current but not in reference:
##
##
## ***Differences of at least 5 and at least 5%
##
## date name newValue refValue absDelta pctDelta
## 1 2021-07-02 hosp_ped 662 597 65 0.10325655
## 2 2021-07-03 hosp_ped 638 597 41 0.06639676
##
##
## ***Differences of at least 0 and at least 0.1%
##
## state name newValue refValue absDelta pctDelta
## 1 AL inp 523814 518483 5331 0.010229330
## 2 TN inp 558512 559654 1142 0.002042631
## 3 NM inp 137802 137991 189 0.001370593
## 4 NH hosp_ped 271 361 90 0.284810127
## 5 ME hosp_ped 452 509 57 0.118626431
## 6 KY hosp_ped 5518 5308 210 0.038795492
## 7 MA hosp_ped 5015 5201 186 0.036413469
## 8 AR hosp_ped 5977 5840 137 0.023186934
## 9 TN hosp_ped 7924 8102 178 0.022213902
## 10 DE hosp_ped 1647 1683 36 0.021621622
## 11 AL hosp_ped 7711 7555 156 0.020437574
## 12 WV hosp_ped 2226 2269 43 0.019132369
## 13 KS hosp_ped 1711 1679 32 0.018879056
## 14 NV hosp_ped 1999 2037 38 0.018830525
## 15 AZ hosp_ped 11435 11266 169 0.014889212
## 16 VA hosp_ped 6604 6513 91 0.013875124
## 17 IN hosp_ped 6913 6826 87 0.012664677
## 18 MS hosp_ped 3727 3686 41 0.011061648
## 19 MO hosp_ped 15406 15241 165 0.010767775
## 20 SC hosp_ped 2706 2679 27 0.010027855
## 21 PA hosp_ped 19857 20010 153 0.007675521
## 22 WA hosp_ped 4288 4263 25 0.005847269
## 23 NM hosp_ped 3125 3107 18 0.005776637
## 24 IA hosp_ped 2275 2287 12 0.005260851
## 25 CO hosp_ped 9355 9401 46 0.004905097
## 26 NJ hosp_ped 9108 9142 34 0.003726027
## 27 OH hosp_ped 25500 25406 94 0.003693081
## 28 IL hosp_ped 19711 19644 67 0.003404904
## 29 GA hosp_ped 21902 21973 71 0.003236467
## 30 MT hosp_ped 1022 1025 3 0.002931119
## 31 PR hosp_ped 11353 11380 27 0.002375401
## 32 CA hosp_ped 30719 30667 52 0.001694197
## 33 LA hosp_ped 3174 3179 5 0.001574059
## 34 TX hosp_ped 38680 38739 59 0.001524174
## 35 FL hosp_ped 54840 54921 81 0.001475934
## 36 HI hosp_ped 720 721 1 0.001387925
## 37 NC hosp_ped 10619 10606 13 0.001224971
## 38 AL hosp_adult 443621 439848 3773 0.008541330
## 39 TN hosp_adult 494022 494969 947 0.001915083
## 40 NM hosp_adult 112634 112842 208 0.001844986
## 41 ME hosp_adult 37173 37121 52 0.001399844
## 42 WV hosp_adult 126618 126444 174 0.001375157
## 43 KY hosp_adult 299353 299757 404 0.001348667
## 44 NH hosp_adult 39064 39014 50 0.001280771
## 45 CA hosp_adult 2422197 2425080 2883 0.001189534
##
##
##
## Raw file for cdcHosp:
## Rows: 27,682
## Columns: 99
## $ state <chr> ~
## $ date <date> ~
## $ critical_staffing_shortage_today_yes <dbl> ~
## $ critical_staffing_shortage_today_no <dbl> ~
## $ critical_staffing_shortage_today_not_reported <dbl> ~
## $ critical_staffing_shortage_anticipated_within_week_yes <dbl> ~
## $ critical_staffing_shortage_anticipated_within_week_no <dbl> ~
## $ critical_staffing_shortage_anticipated_within_week_not_reported <dbl> ~
## $ hospital_onset_covid <dbl> ~
## $ hospital_onset_covid_coverage <dbl> ~
## $ inpatient_beds <dbl> ~
## $ inpatient_beds_coverage <dbl> ~
## $ inpatient_beds_used <dbl> ~
## $ inpatient_beds_used_coverage <dbl> ~
## $ inp <dbl> ~
## $ inpatient_beds_used_covid_coverage <dbl> ~
## $ previous_day_admission_adult_covid_confirmed <dbl> ~
## $ previous_day_admission_adult_covid_confirmed_coverage <dbl> ~
## $ previous_day_admission_adult_covid_suspected <dbl> ~
## $ previous_day_admission_adult_covid_suspected_coverage <dbl> ~
## $ previous_day_admission_pediatric_covid_confirmed <dbl> ~
## $ previous_day_admission_pediatric_covid_confirmed_coverage <dbl> ~
## $ previous_day_admission_pediatric_covid_suspected <dbl> ~
## $ previous_day_admission_pediatric_covid_suspected_coverage <dbl> ~
## $ staffed_adult_icu_bed_occupancy <dbl> ~
## $ staffed_adult_icu_bed_occupancy_coverage <dbl> ~
## $ staffed_icu_adult_patients_confirmed_and_suspected_covid <dbl> ~
## $ staffed_icu_adult_patients_confirmed_and_suspected_covid_coverage <dbl> ~
## $ staffed_icu_adult_patients_confirmed_covid <dbl> ~
## $ staffed_icu_adult_patients_confirmed_covid_coverage <dbl> ~
## $ hosp_adult <dbl> ~
## $ total_adult_patients_hospitalized_confirmed_and_suspected_covid_coverage <dbl> ~
## $ total_adult_patients_hospitalized_confirmed_covid <dbl> ~
## $ total_adult_patients_hospitalized_confirmed_covid_coverage <dbl> ~
## $ hosp_ped <dbl> ~
## $ total_pediatric_patients_hospitalized_confirmed_and_suspected_covid_coverage <dbl> ~
## $ total_pediatric_patients_hospitalized_confirmed_covid <dbl> ~
## $ total_pediatric_patients_hospitalized_confirmed_covid_coverage <dbl> ~
## $ total_staffed_adult_icu_beds <dbl> ~
## $ total_staffed_adult_icu_beds_coverage <dbl> ~
## $ inpatient_beds_utilization <dbl> ~
## $ inpatient_beds_utilization_coverage <dbl> ~
## $ inpatient_beds_utilization_numerator <dbl> ~
## $ inpatient_beds_utilization_denominator <dbl> ~
## $ percent_of_inpatients_with_covid <dbl> ~
## $ percent_of_inpatients_with_covid_coverage <dbl> ~
## $ percent_of_inpatients_with_covid_numerator <dbl> ~
## $ percent_of_inpatients_with_covid_denominator <dbl> ~
## $ inpatient_bed_covid_utilization <dbl> ~
## $ inpatient_bed_covid_utilization_coverage <dbl> ~
## $ inpatient_bed_covid_utilization_numerator <dbl> ~
## $ inpatient_bed_covid_utilization_denominator <dbl> ~
## $ adult_icu_bed_covid_utilization <dbl> ~
## $ adult_icu_bed_covid_utilization_coverage <dbl> ~
## $ adult_icu_bed_covid_utilization_numerator <dbl> ~
## $ adult_icu_bed_covid_utilization_denominator <dbl> ~
## $ adult_icu_bed_utilization <dbl> ~
## $ adult_icu_bed_utilization_coverage <dbl> ~
## $ adult_icu_bed_utilization_numerator <dbl> ~
## $ adult_icu_bed_utilization_denominator <dbl> ~
## $ geocoded_state <lgl> ~
## $ `previous_day_admission_adult_covid_confirmed_18-19` <dbl> ~
## $ `previous_day_admission_adult_covid_confirmed_18-19_coverage` <dbl> ~
## $ `previous_day_admission_adult_covid_confirmed_20-29` <dbl> ~
## $ `previous_day_admission_adult_covid_confirmed_20-29_coverage` <dbl> ~
## $ `previous_day_admission_adult_covid_confirmed_30-39` <dbl> ~
## $ `previous_day_admission_adult_covid_confirmed_30-39_coverage` <dbl> ~
## $ `previous_day_admission_adult_covid_confirmed_40-49` <dbl> ~
## $ `previous_day_admission_adult_covid_confirmed_40-49_coverage` <dbl> ~
## $ `previous_day_admission_adult_covid_confirmed_50-59` <dbl> ~
## $ `previous_day_admission_adult_covid_confirmed_50-59_coverage` <dbl> ~
## $ `previous_day_admission_adult_covid_confirmed_60-69` <dbl> ~
## $ `previous_day_admission_adult_covid_confirmed_60-69_coverage` <dbl> ~
## $ `previous_day_admission_adult_covid_confirmed_70-79` <dbl> ~
## $ `previous_day_admission_adult_covid_confirmed_70-79_coverage` <dbl> ~
## $ `previous_day_admission_adult_covid_confirmed_80+` <dbl> ~
## $ `previous_day_admission_adult_covid_confirmed_80+_coverage` <dbl> ~
## $ previous_day_admission_adult_covid_confirmed_unknown <dbl> ~
## $ previous_day_admission_adult_covid_confirmed_unknown_coverage <dbl> ~
## $ `previous_day_admission_adult_covid_suspected_18-19` <dbl> ~
## $ `previous_day_admission_adult_covid_suspected_18-19_coverage` <dbl> ~
## $ `previous_day_admission_adult_covid_suspected_20-29` <dbl> ~
## $ `previous_day_admission_adult_covid_suspected_20-29_coverage` <dbl> ~
## $ `previous_day_admission_adult_covid_suspected_30-39` <dbl> ~
## $ `previous_day_admission_adult_covid_suspected_30-39_coverage` <dbl> ~
## $ `previous_day_admission_adult_covid_suspected_40-49` <dbl> ~
## $ `previous_day_admission_adult_covid_suspected_40-49_coverage` <dbl> ~
## $ `previous_day_admission_adult_covid_suspected_50-59` <dbl> ~
## $ `previous_day_admission_adult_covid_suspected_50-59_coverage` <dbl> ~
## $ `previous_day_admission_adult_covid_suspected_60-69` <dbl> ~
## $ `previous_day_admission_adult_covid_suspected_60-69_coverage` <dbl> ~
## $ `previous_day_admission_adult_covid_suspected_70-79` <dbl> ~
## $ `previous_day_admission_adult_covid_suspected_70-79_coverage` <dbl> ~
## $ `previous_day_admission_adult_covid_suspected_80+` <dbl> ~
## $ `previous_day_admission_adult_covid_suspected_80+_coverage` <dbl> ~
## $ previous_day_admission_adult_covid_suspected_unknown <dbl> ~
## $ previous_day_admission_adult_covid_suspected_unknown_coverage <dbl> ~
## $ deaths_covid <dbl> ~
## $ deaths_covid_coverage <dbl> ~
##
## -- Column specification --------------------------------------------------------
## cols(
## .default = col_double(),
## Date = col_character(),
## Location = col_character()
## )
## i Use `spec()` for the full column specifications.
##
## *** File has been checked for uniqueness by: state date
##
##
## Checking for similarity of: column names
## In reference but not in current:
## In current but not in reference:
##
## Checking for similarity of: date
## In reference but not in current: 0
## In current but not in reference: 7
##
## Checking for similarity of: state
## In reference but not in current:
## In current but not in reference:
##
##
## ***Differences of at least 1 and at least 1%
##
## [1] date name newValue refValue absDelta pctDelta
## <0 rows> (or 0-length row.names)
##
##
## ***Differences of at least 0 and at least 0.1%
##
## [1] state name newValue refValue absDelta pctDelta
## <0 rows> (or 0-length row.names)
##
##
##
## Raw file for vax:
## Rows: 15,113
## Columns: 69
## $ date <date> 2021-08-03, 2021-08-03, 2021-0~
## $ MMWR_week <dbl> 31, 31, 31, 31, 31, 31, 31, 31,~
## $ state <chr> "MH", "MN", "AL", "MD", "NC", "~
## $ Distributed <dbl> 51300, 6729450, 5167970, 880302~
## $ Distributed_Janssen <dbl> 10800, 349300, 281300, 440400, ~
## $ Distributed_Moderna <dbl> 40500, 2700980, 2377380, 345114~
## $ Distributed_Pfizer <dbl> 0, 3679170, 2509290, 4911480, 6~
## $ Distributed_Unk_Manuf <dbl> 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0~
## $ Dist_Per_100K <dbl> 87823, 119324, 105400, 145608, ~
## $ Distributed_Per_100k_12Plus <dbl> 102839, 140840, 123432, 170506,~
## $ Distributed_Per_100k_18Plus <dbl> 112755, 155182, 135469, 186861,~
## $ Distributed_Per_100k_65Plus <dbl> 518339, 731158, 608113, 917559,~
## $ vxa <dbl> 36161, 6102310, 3634744, 723766~
## $ Administered_12Plus <dbl> 36132, 6082956, 3634417, 723724~
## $ Administered_18Plus <dbl> 36069, 5709218, 3515687, 675157~
## $ Administered_65Plus <dbl> 2101, 1599519, 1225637, 1686839~
## $ Administered_Janssen <dbl> 1206, 273277, 121830, 277559, 3~
## $ Administered_Moderna <dbl> 34955, 2359899, 1661529, 276459~
## $ Administered_Pfizer <dbl> 0, 3468298, 1851381, 4186640, 5~
## $ Administered_Unk_Manuf <dbl> 0, 836, 4, 8864, 457, 36, 565, ~
## $ Administered_Fed_LTC <dbl> 0, 176248, 90554, 195303, 22810~
## $ Administered_Fed_LTC_Residents <dbl> 0, 73383, 48060, 94356, 112427,~
## $ Administered_Fed_LTC_Staff <dbl> 0, 70268, 32757, 74670, 73173, ~
## $ Administered_Fed_LTC_Unk <dbl> 0, 32597, 9737, 26277, 42502, 2~
## $ Administered_Fed_LTC_Dose1 <dbl> 0, 107732, 55156, 115925, 13667~
## $ Administered_Fed_LTC_Dose1_Residents <dbl> 0, 43418, 28477, 52713, 63620, ~
## $ Administered_Fed_LTC_Dose1_Staff <dbl> 0, 41574, 20542, 43429, 42856, ~
## $ Administered_Fed_LTC_Dose1_Unk <dbl> 0, 22740, 6137, 19783, 30194, 1~
## $ Admin_Per_100k <dbl> 61906, 108204, 74130, 119716, 9~
## $ Admin_Per_100k_12Plus <dbl> 72432, 127309, 86805, 140178, 1~
## $ Admin_Per_100k_18Plus <dbl> 79278, 131656, 92157, 143315, 1~
## $ Admin_Per_100k_65Plus <dbl> 21229, 173789, 144220, 175823, ~
## $ Recip_Administered <dbl> 36214, 6130082, 3736050, 728051~
## $ Administered_Dose1_Recip <dbl> 19994, 3333060, 2154479, 392978~
## $ Administered_Dose1_Pop_Pct <dbl> 34.2, 59.1, 43.9, 65.0, 51.6, 5~
## $ Administered_Dose1_Recip_12Plus <dbl> 19973, 3321978, 2154149, 392930~
## $ Administered_Dose1_Recip_12PlusPop_Pct <dbl> 40.0, 69.5, 51.4, 76.1, 60.1, 6~
## $ Administered_Dose1_Recip_18Plus <dbl> 19925, 3123896, 2075040, 366521~
## $ Administered_Dose1_Recip_18PlusPop_Pct <dbl> 43.8, 72.0, 54.4, 77.8, 62.5, 6~
## $ Administered_Dose1_Recip_65Plus <dbl> 1157, 852313, 690242, 895212, 1~
## $ Administered_Dose1_Recip_65PlusPop_Pct <dbl> 11.7, 92.6, 81.2, 93.3, 84.6, 9~
## $ vxc <dbl> 17307, 3040861, 1693504, 356886~
## $ vxcpoppct <dbl> 29.6, 53.9, 34.5, 59.0, 43.9, 4~
## $ Series_Complete_12Plus <dbl> 17298, 3032831, 1693466, 356870~
## $ Series_Complete_12PlusPop_Pct <dbl> 34.7, 63.5, 40.4, 69.1, 51.2, 5~
## $ vxcgte18 <dbl> 17275, 2858303, 1652134, 335011~
## $ vxcgte18pct <dbl> 38.0, 65.9, 43.3, 71.1, 53.6, 5~
## $ vxcgte65 <dbl> 1008, 801731, 591426, 844755, 1~
## $ vxcgte65pct <dbl> 10.2, 87.1, 69.6, 88.1, 77.2, 8~
## $ Series_Complete_Janssen <dbl> 1199, 274012, 124600, 269678, 3~
## $ Series_Complete_Moderna <dbl> 16097, 1116834, 746560, 1310927~
## $ Series_Complete_Pfizer <dbl> 11, 1649722, 822125, 1985705, 2~
## $ Series_Complete_Unk_Manuf <dbl> 0, 293, 219, 2558, 53, 18, 137,~
## $ Series_Complete_Janssen_12Plus <dbl> 1198, 273993, 124594, 269649, 3~
## $ Series_Complete_Moderna_12Plus <dbl> 16089, 1116822, 746549, 1310893~
## $ Series_Complete_Pfizer_12Plus <dbl> 11, 1641723, 822104, 1985603, 2~
## $ Series_Complete_Unk_Manuf_12Plus <dbl> 0, 293, 219, 2558, 53, 18, 137,~
## $ Series_Complete_Janssen_18Plus <dbl> 1195, 273518, 124535, 269534, 3~
## $ Series_Complete_Moderna_18Plus <dbl> 16071, 1114783, 746285, 1310577~
## $ Series_Complete_Pfizer_18Plus <dbl> 9, 1469720, 781095, 1767515, 23~
## $ Series_Complete_Unk_Manuf_18Plus <dbl> 0, 282, 219, 2485, 52, 18, 120,~
## $ Series_Complete_Janssen_65Plus <dbl> 65, 46101, 32206, 50551, 42106,~
## $ Series_Complete_Moderna_65Plus <dbl> 943, 338638, 312228, 402682, 65~
## $ Series_Complete_Pfizer_65Plus <dbl> 0, 416927, 246854, 390774, 6574~
## $ Series_Complete_Unk_Manuf_65Plus <dbl> 0, 65, 138, 748, 35, 11, 54, 0,~
## $ Series_Complete_FedLTC <dbl> 0, 68296, 35927, 78415, 90579, ~
## $ Series_Complete_FedLTC_Residents <dbl> 0, 29784, 19890, 41147, 47820, ~
## $ Series_Complete_FedLTC_Staff <dbl> 0, 28507, 12335, 30545, 29596, ~
## $ Series_Complete_FedLTC_Unknown <dbl> 0, 10005, 3702, 6723, 13163, 14~
##
## Column sums before and after applying filtering rules:
## # A tibble: 3 x 6
## isType tot_cases tot_deaths new_cases new_deaths n
## <chr> <dbl> <dbl> <dbl> <dbl> <dbl>
## 1 before 8.31e+9 1.66e+8 3.51e+7 605510 32981
## 2 after 8.27e+9 1.65e+8 3.49e+7 602741 28509
## 3 pctchg 4.40e-3 3.97e-3 4.59e-3 0.00457 0.136
##
##
## Processed for cdcDaily:
## Rows: 28,509
## Columns: 6
## $ date <date> 2021-02-12, 2020-08-22, 2020-06-05, 2021-07-27, 2021-01-06~
## $ state <chr> "UT", "AR", "HI", "AK", "TX", "TX", "GA", "MA", "OK", "AK",~
## $ tot_cases <dbl> 359641, 56199, 661, 71521, 1867163, 1236648, 493, 662699, 2~
## $ tot_deaths <dbl> 1785, 674, 17, 377, 33124, 23357, 13, 17427, 102, 17, 1331,~
## $ new_cases <dbl> 1060, 547, 8, 235, 24010, 18811, 115, 1598, 96, 29, 89, 870~
## $ new_deaths <dbl> 11, 11, 0, 0, 345, 190, 7, 8, 5, 0, 1, 15, 2, 1, 0, 0, 34, ~
##
## Column sums before and after applying filtering rules:
## # A tibble: 3 x 5
## isType inp hosp_adult hosp_ped n
## <chr> <dbl> <dbl> <dbl> <dbl>
## 1 before 2.78e+7 2.19e+7 471723 27682
## 2 after 2.77e+7 2.18e+7 459822 26679
## 3 pctchg 5.58e-3 5.57e-3 0.0252 0.0362
##
##
## Processed for cdcHosp:
## Rows: 26,679
## Columns: 5
## $ date <date> 2020-07-22, 2020-07-20, 2020-07-19, 2020-07-18, 2020-07-18~
## $ state <chr> "IA", "IA", "ND", "IA", "ND", "TX", "OK", "CT", "ND", "NM",~
## $ inp <dbl> 0, 1, 46, 10, 33, 12003, 678, 215, 16, 119, 51, 19, 250, 14~
## $ hosp_adult <dbl> 0, 1, NA, 10, NA, 7999, 566, 115, NA, NA, NA, NA, NA, NA, N~
## $ hosp_ped <dbl> 0, 0, NA, 0, NA, 194, 9, 0, NA, NA, NA, NA, NA, NA, NA, NA,~
##
## Column sums before and after applying filtering rules:
## # A tibble: 3 x 9
## isType vxa vxc vxcpoppct vxcgte65 vxcgte65pct vxcgte18 vxcgte18pct
## <chr> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
## 1 before 8.40e+10 3.47e+10 311274. 1.13e+10 575411. 3.38e+10 384223.
## 2 after 4.00e+10 1.68e+10 263386. 5.47e+ 9 524476. 1.63e+10 329394.
## 3 pctchg 5.24e- 1 5.16e- 1 0.154 5.16e- 1 0.0885 5.16e- 1 0.143
## # ... with 1 more variable: n <dbl>
##
##
## Processed for vax:
## Rows: 11,883
## Columns: 9
## $ date <date> 2021-08-03, 2021-08-03, 2021-08-03, 2021-08-03, 2021-08-0~
## $ state <chr> "MN", "AL", "MD", "NC", "SD", "MO", "ND", "NE", "WY", "AZ"~
## $ vxa <dbl> 6102310, 3634744, 7237660, 9776317, 854287, 5503756, 66497~
## $ vxc <dbl> 3040861, 1693504, 3568868, 4606310, 416490, 2549091, 30623~
## $ vxcpoppct <dbl> 53.9, 34.5, 59.0, 43.9, 47.1, 41.5, 40.2, 49.7, 36.7, 45.4~
## $ vxcgte65 <dbl> 801731, 591426, 844755, 1352070, 131441, 792717, 89800, 26~
## $ vxcgte65pct <dbl> 87.1, 69.6, 88.1, 77.2, 86.5, 74.6, 74.9, 85.7, 73.6, 74.5~
## $ vxcgte18 <dbl> 2858303, 1652134, 3350111, 4390894, 400144, 2446269, 29565~
## $ vxcgte18pct <dbl> 65.9, 43.3, 71.1, 53.6, 59.9, 51.3, 50.8, 62.6, 46.2, 55.7~
##
## Integrated per capita data file:
## Rows: 28,722
## Columns: 34
## $ date <date> 2020-01-01, 2020-01-01, 2020-01-01, 2020-01-01, 2020-01-0~
## $ state <chr> "AL", "HI", "IN", "LA", "MN", "MT", "NC", "TX", "AL", "HI"~
## $ tot_cases <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA~
## $ tot_deaths <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA~
## $ new_cases <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA~
## $ new_deaths <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA~
## $ inp <dbl> NA, 0, 0, NA, 0, 0, 0, 0, NA, 0, 0, NA, 0, 0, 0, 1877, 0, ~
## $ hosp_adult <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA~
## $ hosp_ped <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA~
## $ vxa <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA~
## $ vxc <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA~
## $ vxcpoppct <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA~
## $ vxcgte65 <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA~
## $ vxcgte65pct <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA~
## $ vxcgte18 <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA~
## $ vxcgte18pct <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA~
## $ tcpm <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA~
## $ tdpm <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA~
## $ cpm <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA~
## $ dpm <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA~
## $ hpm <dbl> NA, 0.0000, 0.0000, NA, 0.0000, 0.0000, 0.0000, 0.0000, NA~
## $ ahpm <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA~
## $ phpm <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA~
## $ vxapm <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA~
## $ vxcpm <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA~
## $ tcpm7 <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA~
## $ tdpm7 <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA~
## $ cpm7 <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA~
## $ dpm7 <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA~
## $ hpm7 <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA~
## $ ahpm7 <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA~
## $ phpm7 <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA~
## $ vxapm7 <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA~
## $ vxcpm7 <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA~
## Warning in showSRID(uprojargs, format = "PROJ", multiline = "NO", prefer_proj =
## prefer_proj): Discarded datum unknown in CRS definition
saveToRDS(cdc_daily_210804)
The raw hospital data is explored for admissions with confirmed/suspected coronavirus:
cdcHospAdmit_210804 <- cdc_daily_210804$dfRaw$cdcHosp %>%
select(state, date, ends_with("confirmed"), ends_with("suspected")) %>%
filter(state %in% c(state.abb, "DC")) %>%
arrange(date, state) %>%
pivot_longer(-c(state, date)) %>%
mutate(name=stringr::str_replace(name, pattern="previous_day_admission_", replacement=""),
name=stringr::str_replace(name, pattern="_covid", replacement="")
) %>%
left_join(getStateData(keepVars=c("state", "pop")), by="state") %>%
mutate(vpm=1000000*value/pop) %>%
group_by(state, name) %>%
mutate(vpm7=zoo::rollmean(vpm, k=7, fill=NA)) %>%
ungroup()
cdcHospAdmit_210804 %>%
filter(!is.na(vpm7), state %in% state.abb) %>%
mutate(div=as.character(state.division)[match(state, state.abb)]) %>%
group_by(div, date, name) %>%
summarize(wt_vpm7=sum(pop*vpm7)/sum(pop), tot_pop=sum(pop), .groups="drop") %>%
ggplot(aes(x=date, y=wt_vpm7)) +
geom_col(aes(fill=name), position="stack") +
facet_wrap(~div) +
scale_fill_discrete("Metric") +
labs(x=NULL,
y="Newly admitted for COVID per million (rolling 7-day)",
title="Hospital admissions for COVID",
subtitle="All metrics divided by total population (all ages) for states reporting"
)
Hospital coverage data became robust about a year ago. The overwhelming majority of admissions are adult, split between confirmed and suspected cases. Next steps are to explore changes in admissions by age groups:
hospAge_210804 <- cdc_daily_210804$dfRaw$cdcHosp %>%
select(state,
date,
grep(x=names(.), pattern="ed_\\d.*[9+]$", value=TRUE),
grep(x=names(.), pattern="pediatric.*ed$", value=TRUE)
) %>%
pivot_longer(-c(state, date)) %>%
mutate(confSusp=ifelse(grepl(x=name, pattern="confirmed"), "confirmed", "suspected"),
adultPed=ifelse(grepl(x=name, pattern="adult"), "adult", "ped"),
age=ifelse(adultPed=="ped", "0-17", stringr::str_replace_all(string=name, pattern=".*_", replacement="")),
age=ifelse(age %in% c("0-17", "18-19"), "0-19", age),
div=as.character(state.division)[match(state, state.abb)]
)
hospAge_210804
## # A tibble: 498,276 x 8
## state date name value confSusp adultPed age div
## <chr> <date> <chr> <dbl> <chr> <chr> <chr> <chr>
## 1 PR 2020-07-27 previous_day_admission_~ NA confirm~ adult 0-19 <NA>
## 2 PR 2020-07-27 previous_day_admission_~ NA confirm~ adult 20-29 <NA>
## 3 PR 2020-07-27 previous_day_admission_~ NA confirm~ adult 30-39 <NA>
## 4 PR 2020-07-27 previous_day_admission_~ NA confirm~ adult 40-49 <NA>
## 5 PR 2020-07-27 previous_day_admission_~ NA confirm~ adult 50-59 <NA>
## 6 PR 2020-07-27 previous_day_admission_~ NA confirm~ adult 60-69 <NA>
## 7 PR 2020-07-27 previous_day_admission_~ NA confirm~ adult 70-79 <NA>
## 8 PR 2020-07-27 previous_day_admission_~ NA confirm~ adult 80+ <NA>
## 9 PR 2020-07-27 previous_day_admission_~ NA suspect~ adult 0-19 <NA>
## 10 PR 2020-07-27 previous_day_admission_~ NA suspect~ adult 20-29 <NA>
## # ... with 498,266 more rows
# Plot for overall trends by age group
p1 <- hospAge_210804 %>%
filter(state %in% c(state.abb, "DC"), !is.na(value)) %>%
mutate(ageBucket=age) %>%
group_by(date, ageBucket) %>%
summarize(value=sum(value), .groups="drop") %>%
arrange(date) %>%
group_by(ageBucket) %>%
mutate(value7=zoo::rollmean(value, k=7, fill=NA)) %>%
filter(date >= "2020-08-01") %>%
ggplot(aes(x=date, y=value7)) +
labs(x=NULL,
y="Confirmed or suspected COVID admissions (rolling-7 mean)",
title="Hospital admissions for COVID by age bucket (Aug 2020 - Jul 2021)",
subtitle="50 states and DC (includes confirmed and suspected from CDC data)"
) +
lims(y=c(0, NA))
# Line plots by age group
p1 +
geom_line(aes(group=ageBucket, color=ageBucket), size=1) +
scale_color_discrete("Age\nbucket")
## Warning: Removed 24 row(s) containing missing values (geom_path).
# Stacked bar plots by age group
p1 +
geom_col(aes(fill=ageBucket), position="stack") +
scale_color_discrete("Age\nbucket")
## Warning: Removed 24 rows containing missing values (position_stack).
# Proportions by age group
p1 +
geom_col(aes(fill=ageBucket), position="fill") +
scale_color_discrete("Age\nbucket")
## Warning: Removed 24 rows containing missing values (position_stack).
# Plot for overall trends by age group
hospAge_210804 %>%
filter(state %in% state.abb, !is.na(value)) %>%
mutate(ageBucket=ifelse(age >= "60", "60+", ifelse(age=="0-19", "0-19", "20-59"))) %>%
group_by(date, state, ageBucket) %>%
summarize(value=sum(value), .groups="drop") %>%
group_by(ageBucket, state) %>%
mutate(value7=zoo::rollmean(value, k=7, fill=NA)) %>%
filter(date >= "2020-06-01") %>%
ggplot(aes(x=date, y=value7)) +
geom_line(aes(color=ageBucket, group=ageBucket)) +
scale_color_discrete("Age\nbucket") +
labs(x=NULL,
y="Confirmed or suspected COVID admissions (rolling-7 mean)",
title="Hospital admissions for COVID by age bucket (Aug 2020 - Jul 2021)"
) +
lims(y=c(0, NA)) +
facet_wrap(~state, scales="free_y")
## Warning: Removed 18 row(s) containing missing values (geom_path).
Next steps are to explore alignment of the hospitalization and case/death curves. Michigan having had a distinct spring peak is used as an example:
allHosp_210804 <- hospAge_210804 %>%
mutate(ageBucket=ifelse(age >= "60", "60+", ifelse(age=="0-19", "0-19", "20-59"))) %>%
group_by(date, state, ageBucket) %>%
summarize(value=sum(value), .groups="drop") %>%
group_by(ageBucket, state) %>%
mutate(value7=zoo::rollmean(value, k=7, fill=NA)) %>%
ungroup() %>%
left_join(getStateData(keepVars=c("state", "pop"))) %>%
mutate(vpm7=1000000*value7/pop)
## Joining, by = "state"
allHosp_210804
## # A tibble: 83,046 x 7
## date state ageBucket value value7 pop vpm7
## <date> <chr> <chr> <dbl> <dbl> <dbl> <dbl>
## 1 2020-01-01 AL 0-19 NA NA 4903185 NA
## 2 2020-01-01 AL 20-59 NA NA 4903185 NA
## 3 2020-01-01 AL 60+ NA NA 4903185 NA
## 4 2020-01-01 HI 0-19 NA NA 1415872 NA
## 5 2020-01-01 HI 20-59 NA NA 1415872 NA
## 6 2020-01-01 HI 60+ NA NA 1415872 NA
## 7 2020-01-01 IN 0-19 NA NA 6732219 NA
## 8 2020-01-01 IN 20-59 NA NA 6732219 NA
## 9 2020-01-01 IN 60+ NA NA 6732219 NA
## 10 2020-01-01 LA 0-19 NA NA 4648794 NA
## # ... with 83,036 more rows
allCaseDeath_210804 <- cdc_daily_210804$dfPerCapita %>%
select(state, date, new_cases, new_deaths, vxa, vxc, cpm7, dpm7, vxapm7, vxcpm7) %>%
pivot_longer(-c(state, date))
allCaseDeath_210804
## # A tibble: 229,776 x 4
## state date name value
## <chr> <date> <chr> <dbl>
## 1 AL 2020-01-01 new_cases NA
## 2 AL 2020-01-01 new_deaths NA
## 3 AL 2020-01-01 vxa NA
## 4 AL 2020-01-01 vxc NA
## 5 AL 2020-01-01 cpm7 NA
## 6 AL 2020-01-01 dpm7 NA
## 7 AL 2020-01-01 vxapm7 NA
## 8 AL 2020-01-01 vxcpm7 NA
## 9 HI 2020-01-01 new_cases NA
## 10 HI 2020-01-01 new_deaths NA
## # ... with 229,766 more rows
allPivot_210804 <- allHosp_210804 %>%
select(state, date, name=ageBucket, value=vpm7) %>%
bind_rows(allCaseDeath_210804) %>%
checkUniqueRows(uniqueBy=c("state", "date", "name"))
##
## *** File has been checked for uniqueness by: state date name
allPivot_210804
## # A tibble: 312,822 x 4
## state date name value
## <chr> <date> <chr> <dbl>
## 1 AL 2020-01-01 0-19 NA
## 2 AL 2020-01-01 20-59 NA
## 3 AL 2020-01-01 60+ NA
## 4 HI 2020-01-01 0-19 NA
## 5 HI 2020-01-01 20-59 NA
## 6 HI 2020-01-01 60+ NA
## 7 IN 2020-01-01 0-19 NA
## 8 IN 2020-01-01 20-59 NA
## 9 IN 2020-01-01 60+ NA
## 10 LA 2020-01-01 0-19 NA
## # ... with 312,812 more rows
# Plot Michigan data
typeMapper <- c("cases"="1. Cases per million per day (rolling 7 mean)",
"deaths"="2. Deaths per million per day (rolling 7 mean)",
"hosp"="3. Admitted to hospital per million per day (rolling 7 mean)",
"vax"="4. Vaccinated per capita (administered, completed)"
)
allPivot_210804 %>%
filter(state=="MI", !is.na(value)) %>%
mutate(plotType=case_when(name %in% c("0-19", "20-59", "60+") ~ "hosp",
name %in% c("vxapm7", "vxcpm7") ~ "vax",
name=="cpm7" ~ "cases",
name=="dpm7" ~ "deaths",
TRUE ~ "notuse"
)
) %>%
filter(plotType != "notuse") %>%
ggplot(aes(x=date, y=value)) +
geom_line(data=~filter(., plotType=="cases"), color="blue", size=1) +
geom_line(data=~filter(., plotType=="deaths"), color="red", size=1) +
geom_line(data=~filter(., plotType=="vax"), aes(color=name, group=name, y=value/1000000)) +
geom_col(data=~filter(., plotType=="hosp"), aes(fill=name), position="stack") +
scale_color_discrete("Vaccine\nMetric") +
scale_fill_discrete("Hospitalized\nby Age") +
facet_wrap(~typeMapper[plotType], scales="free_y") +
labs(x=NULL, y=NULL) +
lims(y=c(0, NA))
hospCase <- 10
allPivot_210804 %>%
filter(state=="MI", !is.na(value)) %>%
mutate(plotType=case_when(name %in% c("0-19", "20-59", "60+") ~ "hosp",
name %in% c("vxapm7", "vxcpm7") ~ "vax",
name=="cpm7" ~ "cases",
name=="dpm7" ~ "deaths",
TRUE ~ "notuse"
)
) %>%
filter(plotType %in% c("cases", "hosp")) %>%
ggplot(aes(x=date, y=value)) +
geom_col(data=~filter(., plotType=="hosp"), aes(fill=name, y=hospCase*value), position="stack") +
geom_line(data=~filter(., plotType=="cases"), color="black", size=1) +
scale_fill_discrete("Hospital Admssions by Age") +
scale_y_continuous("Cases per million (rolling 7 mean per day)",
sec.axis = sec_axis(~ . / hospCase,
name = "Hospital admissions per million (rolling 7 mean per day"
)
) +
labs(x=NULL,
title="Alignment of Michigan cases and hospitalizations data",
subtitle=paste0("Ratio of ",
hospCase,
":1 applied (cases are black line, hospital admissions are stacked bar)"
)
) +
theme(legend.position="bottom")
hospDeath <- 0.2
allPivot_210804 %>%
filter(state=="MI", !is.na(value)) %>%
mutate(plotType=case_when(name %in% c("0-19", "20-59", "60+") ~ "hosp",
name %in% c("vxapm7", "vxcpm7") ~ "vax",
name=="cpm7" ~ "cases",
name=="dpm7" ~ "deaths",
TRUE ~ "notuse"
)
) %>%
filter(plotType %in% c("deaths", "hosp")) %>%
ggplot(aes(x=date, y=value)) +
geom_col(data=~filter(., plotType=="hosp"), aes(fill=name, y=hospDeath*value), position="stack") +
geom_line(data=~filter(., plotType=="deaths"), color="black", size=1) +
scale_fill_discrete("Hospital Admssions by Age") +
scale_y_continuous("Deaths per million (rolling 7 mean per day)",
sec.axis = sec_axis(~ . / hospDeath,
name = "Hospital admissions per million (rolling 7 mean per day"
)
) +
labs(x=NULL,
title="Alignment of Michigan deaths and hospitalizations data",
subtitle=paste0("Ratio of ",
hospDeath,
":1 applied (deaths are black line, hospital admissions are stacked bar)"
)
) +
theme(legend.position="bottom")
At a glance, the Michigan data appear reasonably well aligned. Hospital admissions run at ~10% of confirmed cases with a small delay. Deaths run at ~20% of hospital admissions in the mid-winter wave and ~10% of admissions in the spring wave. These are consistent with estimates of ~1.5% CFR and ~5 cases per diagnosed cases (fatality rate ~0.3%).
Next steps are to convert this process to functional form, automate selection of scaling parameters, and explore other states of interest:
# Function to create case-hospital-death file
makeCaseHospDeath <- function(dfHosp, dfCaseDeath) {
# FUNCTION ARGUMENTS:
# dfHosp: the tibble or data.frame containing the hospital data by date-state
# dfCaseDeath: the tibble or data.frame containing the case and death data by date-state
allHosp <- dfHosp %>%
mutate(ageBucket=ifelse(age >= "60", "60+", ifelse(age=="0-19", "0-19", "20-59"))) %>%
group_by(date, state, ageBucket) %>%
summarize(value=sum(value), .groups="drop") %>%
group_by(ageBucket, state) %>%
mutate(value7=zoo::rollmean(value, k=7, fill=NA)) %>%
ungroup() %>%
left_join(getStateData(keepVars=c("state", "pop"))) %>%
mutate(vpm7=1000000*value7/pop)
allCaseDeath <- dfCaseDeath %>%
select(state, date, new_cases, new_deaths, vxa, vxc, cpm7, dpm7, vxapm7, vxcpm7) %>%
pivot_longer(-c(state, date))
allPivot <- allHosp %>%
select(state, date, name=ageBucket, value=vpm7) %>%
bind_rows(allCaseDeath) %>%
checkUniqueRows(uniqueBy=c("state", "date", "name"))
allPivot
}
alignCaseHospDeath <- function(dfPivot=NULL,
dfHosp=NULL,
dfCaseDeath=NULL,
typeMapper=c("cases"="1. Cases per million per day (rolling 7 mean)",
"deaths"="2. Deaths per million per day (rolling 7 mean)",
"hosp"="3. Admitted to hospital per million per day (rolling 7 mean)",
"vax"="4. Vaccinated per capita (administered, completed)"
),
keyState="MI",
hospCaseScalar=10,
hospDeathScalar=0.2,
returnPlots=FALSE
)
{
# FUNCTION ARGUMENTS:
# dfPivot: the tibble or data.frame containing integrated case-hospital-death data
# (if NULL, build from dfHosp and dfCaseDeath)
# dfHosp: the tibble or data.frame containing the hospital data by date-state
# dfCaseDeath: the tibble or data.frame containing the case and death data by date-state
# typeMapper: mapping file for labelling facets
# keyState: the state to explore
# hospCaseScalar: the scalar to be applied for placing cases and hospitalizations on the same plot
# hospDeathScalar: the scalar to be applied for placing hospitalizations and deaths on the same plot
# Create the pivoted data if it was not passed
if (is.null(dfPivot)) {
if (is.null(dfHosp) | is.null(dfCaseDeath)) stop("\nMust pass dfPivot OR both of dfHosp and dfCaseDeath\n")
dfPivot <- makeCaseHospDeath(dfHosp=dfHosp, dfCaseDeath=dfCaseDeath)
}
# Create the plotting data
plotData <- dfPivot %>%
filter(state==keyState, !is.na(value)) %>%
mutate(plotType=case_when(name %in% c("0-19", "20-59", "60+") ~ "hosp",
name %in% c("vxapm7", "vxcpm7") ~ "vax",
name=="cpm7" ~ "cases",
name=="dpm7" ~ "deaths",
TRUE ~ "notuse"
)
)
# Create overall plot
p1 <- plotData %>%
filter(plotType != "notuse") %>%
ggplot(aes(x=date, y=value)) +
geom_line(data=~filter(., plotType=="cases"), color="blue", size=1) +
geom_line(data=~filter(., plotType=="deaths"), color="red", size=1) +
geom_line(data=~filter(., plotType=="vax"), aes(color=name, group=name, y=value/1000000)) +
geom_col(data=~filter(., plotType=="hosp"), aes(fill=name), position="stack") +
scale_color_discrete("Vaccine\nMetric") +
scale_fill_discrete("Hospitalized\nby Age") +
facet_wrap(~typeMapper[plotType], scales="free_y") +
labs(x=NULL, y=NULL, title=paste0("Key coronavirus metrics for state: ", keyState)) +
lims(y=c(0, NA))
print(p1)
p2 <- plotData %>%
filter(plotType %in% c("cases", "hosp")) %>%
ggplot(aes(x=date, y=value)) +
geom_col(data=~filter(., plotType=="hosp"), aes(fill=name, y=hospCaseScalar*value), position="stack") +
geom_line(data=~filter(., plotType=="cases"), color="black", size=1) +
scale_fill_discrete("Hospital Admssions by Age") +
scale_y_continuous("Cases per million (rolling 7 mean per day)",
sec.axis = sec_axis(~ . / hospCaseScalar,
name = "Hospital admissions per million (rolling 7 mean per day"
)
) +
labs(x=NULL,
title=paste0("Alignment of ", keyState, " cases and hospitalizations data"),
subtitle=paste0("Ratio of ",
hospCaseScalar,
":1 applied (cases are black line, hospital admissions are stacked bar)"
)
) +
theme(legend.position="bottom")
print(p2)
p3 <- plotData %>%
filter(plotType %in% c("deaths", "hosp")) %>%
ggplot(aes(x=date, y=value)) +
geom_col(data=~filter(., plotType=="hosp"), aes(fill=name, y=hospDeathScalar*value), position="stack") +
geom_line(data=~filter(., plotType=="deaths"), color="black", size=1) +
scale_fill_discrete("Hospital Admssions by Age") +
scale_y_continuous("Deaths per million (rolling 7 mean per day)",
sec.axis = sec_axis(~ . / hospDeathScalar,
name = "Hospital admissions per million (rolling 7 mean per day"
)
) +
labs(x=NULL,
title=paste0("Alignment of ", keyState, " deaths and hospitalizations data"),
subtitle=paste0("Ratio of ",
hospDeathScalar,
":1 applied (deaths are black line, hospital admissions are stacked bar)"
)
) +
theme(legend.position="bottom")
print(p3)
if(isTRUE(returnPlots)) list(p1=p1, p2=p2, p3=p3)
}
The function is tested for MI, FL, and TX:
dfPivot_210804 <- makeCaseHospDeath(dfHosp=hospAge_210804, dfCaseDeath=cdc_daily_210804$dfPerCapita)
## Joining, by = "state"
##
## *** File has been checked for uniqueness by: state date name
dfPivot_210804
## # A tibble: 312,822 x 4
## state date name value
## <chr> <date> <chr> <dbl>
## 1 AL 2020-01-01 0-19 NA
## 2 AL 2020-01-01 20-59 NA
## 3 AL 2020-01-01 60+ NA
## 4 HI 2020-01-01 0-19 NA
## 5 HI 2020-01-01 20-59 NA
## 6 HI 2020-01-01 60+ NA
## 7 IN 2020-01-01 0-19 NA
## 8 IN 2020-01-01 20-59 NA
## 9 IN 2020-01-01 60+ NA
## 10 LA 2020-01-01 0-19 NA
## # ... with 312,812 more rows
miAlign <- alignCaseHospDeath(dfPivot_210804, keyState="MI", returnPlots=TRUE)
flAlign <- alignCaseHospDeath(dfPivot_210804, keyState="FL", returnPlots=TRUE, hospDeathScalar=0.14)
txAlign <- alignCaseHospDeath(dfPivot_210804, keyState="TX", returnPlots=TRUE, hospDeathScalar=0.14)
# Key plots on a single page
gridExtra::grid.arrange(miAlign$p1, flAlign$p1, txAlign$p1, nrow=2)
gridExtra::grid.arrange(miAlign$p2, flAlign$p2, txAlign$p2, nrow=1)
gridExtra::grid.arrange(miAlign$p3, flAlign$p3, txAlign$p3, nrow=1)
Next, an implied CFR (deaths per case) rate is calculated for inclusion:
# Filter to single-state data
miData <- dfPivot_210804 %>%
filter(state=="MI", name %in% c("cpm7", "dpm7"), !is.na(value))
# Plot core metrics
miData %>%
ggplot(aes(x=date, y=value)) +
geom_line(aes(group=name, color=name)) +
facet_wrap(~c("cpm7"="Cases per million", "dpm7"="Deaths per million")[name], scales="free_y") +
labs(x=NULL, y="Value per million (rolling 7-day mean)", title="Coronavirus burden in state: MI") +
theme(legend.position="none")
# Create correlation for assigned lag/lead and variables in a data frame
lagCorrCheck <- function(df, lagLead=0, varFix="dpm7", varMove="cpm7") {
df %>%
mutate(lagVar=if(lagLead >= 0) lag(get(varMove), lagLead) else lead(get(varMove), abs(lagLead))) %>%
filter(!is.na(lagVar)) %>%
summarize(correl=cor(lagVar, get(varFix))) %>%
pull(correl)
}
miCorrDF <- miData %>%
select(date, name, value) %>%
pivot_wider(date)
miCorrDF
## # A tibble: 553 x 3
## date cpm7 dpm7
## <date> <dbl> <dbl>
## 1 2020-01-25 0 0
## 2 2020-01-26 0 0
## 3 2020-01-27 0 0
## 4 2020-01-28 0 0
## 5 2020-01-29 0 0
## 6 2020-01-30 0 0
## 7 2020-01-31 0 0
## 8 2020-02-01 0 0
## 9 2020-02-02 0 0
## 10 2020-02-03 0 0
## # ... with 543 more rows
# Assessing best lag/lead for full dataset
lagLeads=-10:40
miRhoFull <- tibble::tibble(lagLead=lagLeads,
rho=sapply(lagLeads, FUN=function(x) lagCorrCheck(miCorrDF, lagLead=x))
)
bestFull <- miRhoFull %>% filter(rho==max(rho))
miRhoFull %>%
ggplot(aes(x=lagLead, y=rho)) +
geom_point() +
geom_hline(data=bestFull, aes(yintercept=rho), lty=2) +
geom_vline(data=bestFull, aes(xintercept=lagLead), lty=2) +
labs(x="Lag or lead of cases",
y="Correlation to deaths",
title="All Michigan case and death data",
subtitle=paste0("Best correlation ",
round(bestFull$rho, 3),
" obtained at lag/lead of: ",
bestFull$lagLead
)
)
# Assessing best lag/lead for August 2020 and beyond
lagLeads=-10:40
miRhoLate <- tibble::tibble(lagLead=lagLeads,
rho=sapply(lagLeads,
FUN=function(x) lagCorrCheck(miCorrDF %>% filter(date >= "2020-08-01"),
lagLead=x
)
)
)
bestLate <- miRhoLate %>% filter(rho==max(rho))
miRhoLate %>%
ggplot(aes(x=lagLead, y=rho)) +
geom_point() +
geom_hline(data=bestLate, aes(yintercept=rho), lty=2) +
geom_vline(data=bestLate, aes(xintercept=lagLead), lty=2) +
labs(x="Lag or lead of cases",
y="Correlation to deaths",
title="Michigan case and death data (August 2020 to present)",
subtitle=paste0("Best correlation ",
round(bestLate$rho, 3),
" obtained at lag/lead of: ",
bestLate$lagLead
)
)
miCorrDF %>%
mutate(lag20=lag(cpm7, 20)) %>%
filter(!is.na(lag20), lag20 > 0) %>%
ggplot(aes(x=date)) +
geom_line(aes(y=cpm7), color="navy") +
geom_line(aes(y=lag20), color="navy", lty=2) +
geom_line(aes(y=8000*pmin(0.1, dpm7/lag20)), color="red") +
scale_y_continuous("Cases per million (rolling 7 mean per day) - actual and 20-day lag",
sec.axis = sec_axis(~ . / 8000,
name = "Implied CFR (capped at 10%)"
)
) +
labs(x=NULL, title="Implied case fatality rate using 20-day lag in Michigan")
miCorrDF %>%
mutate(lag20=lag(cpm7, 20)) %>%
filter(!is.na(lag20)) %>%
ggplot(aes(x=date)) +
geom_line(aes(y=cpm7), color="navy") +
geom_line(aes(y=lag20), color="navy", lty=2) +
geom_line(aes(y=50*dpm7), color="red") +
labs(x=NULL,
y="Per million (7-day rolling mean)\nCases, Lag-20 cases, and 50*Deaths",
title="Burden metrics for Michigan"
)
Michigan appears to fairly consistently have a lag of 2-3 weeks between cases and deaths. The CFR during spikes has consistently declined from over 10% to around 2% to around 1%. The estimated CFR outside of spikes appears noisy. Next steps are to convert to functional form and run for other states:
# Create correlation for assigned lag/lead and variables in a data frame
lagCorrCheck <- function(df, lagLead=0, varFix="dpm7", varMove="cpm7") {
df %>%
mutate(lagVar=if(lagLead >= 0) lag(get(varMove), lagLead) else lead(get(varMove), abs(lagLead))) %>%
filter(!is.na(lagVar)) %>%
summarize(correl=cor(lagVar, get(varFix))) %>%
pull(correl)
}
findCorrAlign <- function(df,
keyState,
varFix="dpm7",
varMove="cpm7",
lagLeads=-10:40,
minDate=NULL,
maxDate=NULL,
varMapper=c("cpm7"="Cases per million", "dpm7"="Deaths per million"),
yLab="Value per million (rolling 7-day mean)",
printPlots=TRUE,
returnPlots=FALSE,
returnData=FALSE
) {
# FUNCTION ARGUMENTS
# df: pivoted data frame with state-date-name-value
# keyState: state to include
# varFix: metric to be held constant
# varMove: metric to be lagged/led
# lagLeads: lags and leads for the variable that moves
# minDate: minimum date for lag/lead (NULL means data-driven)
# maxDate: maximum date for lag/lead (NULL means data-driven)
# varMapper: mapping file for varFix and varMove to descriptive labels
# yLab: label for the y-axis in the first plot
# printPlots: boolean, should the plots be printed?
# returnPlots: boolean, should the plots be returned?
# returnData: boolean, should the data frames be returned as a list?
# Set minDate and maxDate to the actual minmax if passed as NULL
if (is.null(minDate)) minDate <- df %>% summarize(date=min(date)) %>% pull(date)
if (is.null(maxDate)) maxDate <- df %>% summarize(date=max(date)) %>% pull(date)
# Filter to relevant data
df <- df %>%
filter(state %in% all_of(keyState), name %in% all_of(c(varFix, varMove)), !is.na(value))
# Plot core metrics for requested states
p1 <- df %>%
ggplot(aes(x=date, y=value)) +
geom_line(aes(group=name, color=name)) +
facet_wrap(~varMapper[name], scales="free_y") +
labs(x=NULL, y=yLab, title=paste0("Metrics by state for: ", paste0(keyState, collapse=", "))) +
theme(legend.position="none")
if(isTRUE(printPlots)) print(p1)
# Create dataset for correlations
dfCorr <- df %>%
select(date, name, value) %>%
pivot_wider(date)
# Find correlation by lag/lead for dataset
dfRho <- tibble::tibble(lagLead=lagLeads,
rho=sapply(lagLeads,
FUN=function(x) {
lagCorrCheck(dfCorr %>% filter(date >= minDate, date <= maxDate),
lagLead=x
)
}
)
)
# Find best correlation and lag/lead
bestRho <- dfRho %>%
filter(rho==max(rho))
# Plot correlations by lag/lead
p2 <- dfRho %>%
ggplot(aes(x=lagLead, y=rho)) +
geom_point() +
geom_hline(data=bestRho, aes(yintercept=rho), lty=2) +
geom_vline(data=bestRho, aes(xintercept=lagLead), lty=2) +
labs(x=paste0("Lag or lead of ", varMapper[varMove]),
y=paste0("Correlation to ", varMapper[varFix]),
title=paste0("Correlations by lag/lead for state: ", keyState),
subtitle=paste0("Best correlation ",
round(bestRho$rho, 3),
" obtained at lag/lead of: ",
bestRho$lagLead
)
)
if(isTRUE(printPlots)) print(p2)
if (isTRUE(returnData) | isTRUE(returnPlots)) {
list(dfRho=if(isTRUE(returnData)) dfRho else NULL,
bestRho=if(isTRUE(returnData)) bestRho else NULL,
dfCorr=if(isTRUE(returnData)) dfCorr else NULL,
p1=if(isTRUE(returnPlots)) p1 else NULL,
p2=if(isTRUE(returnPlots)) p2 else NULL
)
}
}
findCorrAlign(dfPivot_210804, keyState="MI")
findCorrAlign(dfPivot_210804, keyState="MI", minDate="2020-08-01", returnData=TRUE)
## $dfRho
## # A tibble: 51 x 2
## lagLead rho
## <int> <dbl>
## 1 -10 0.320
## 2 -9 0.348
## 3 -8 0.376
## 4 -7 0.404
## 5 -6 0.432
## 6 -5 0.460
## 7 -4 0.488
## 8 -3 0.515
## 9 -2 0.543
## 10 -1 0.570
## # ... with 41 more rows
##
## $bestRho
## # A tibble: 1 x 2
## lagLead rho
## <int> <dbl>
## 1 20 0.880
##
## $dfCorr
## # A tibble: 553 x 3
## date cpm7 dpm7
## <date> <dbl> <dbl>
## 1 2020-01-25 0 0
## 2 2020-01-26 0 0
## 3 2020-01-27 0 0
## 4 2020-01-28 0 0
## 5 2020-01-29 0 0
## 6 2020-01-30 0 0
## 7 2020-01-31 0 0
## 8 2020-02-01 0 0
## 9 2020-02-02 0 0
## 10 2020-02-03 0 0
## # ... with 543 more rows
##
## $p1
## NULL
##
## $p2
## NULL
findCorrAlign(dfPivot_210804, keyState="FL")
findCorrAlign(dfPivot_210804, keyState="TX", minDate="2020-10-01")
Next steps are to create functional form for calculating IFR and aligning plots:
plotCFRLag <- function(lst,
lagUse=NULL,
scaleUse=NULL,
cfrCap=0.06,
multDeath=50,
mainTitle="Coronavirus data for selected geography: ",
printPlots=TRUE,
returnPlots=FALSE
) {
# FUNCTION ARGUMENTS:
# lst: data frame with date-cpm7-dpm7 OR list with both dfCorr and bestRho
# lagUse: the lag to use (if NULL, use the value in bestRho$lagLead)
# scaleUse: scalar for secondary y-axis (NULL means calculate from data)
# cfrCap: the cap for all values of CFR
# multDeath: multiplier for death data in plot 2
# mainTitle: main title for plots
# printPlots: boolean, should the plots be printed?
# returnPlots: boolean, should the plots be returned?
# Create dfCorr and lagUse
if ("list" %in% class(lst)) {
dfCorr <- lst[["dfCorr"]]
if (is.null(lagUse)) lagUse <- lst[["bestRho"]]$lagLead
} else {
dfCorr <- lst
}
# Check that dfCorr is a data frame with date-cpm7-dpm7 and lagUse is not NULL
if (!("data.frame" %in% class(dfCorr))) stop("\nMust have a data frame for lst/dfCorr\n")
if (!(all(c("date", "cpm7", "dpm7") %in% names(dfCorr)))) stop("\ndfCorr must have date-cpm7-dpm7\n")
if (is.null(lagUse)) stop("\nMust have a value for lagUse\n")
# Create scaleUse if not passed
if (is.null(scaleUse)) scaleUse <- 500*ceiling(max(dfCorr$cpm7)/cfrCap/500)
# Create plot of CFR by date, showing lagged cases
basePlot <- dfCorr %>%
mutate(lagData=if(lagUse >= 0) lag(cpm7, lagUse) else lead(cpm7, -lagUse)) %>%
filter(!is.na(lagData), lagData > 0) %>%
ggplot(aes(x=date)) +
geom_line(aes(y=cpm7), color="navy") +
geom_line(aes(y=lagData), color="navy", lty=2)
p1 <- basePlot +
geom_line(aes(y=scaleUse*pmin(cfrCap, dpm7/lagData)), color="red") +
scale_y_continuous(paste0("Cases per million\n(rolling 7-day mean)"),
sec.axis = sec_axis(~ . / scaleUse,
name = paste0("Implied CFR (capped at ",
round(100*cfrCap, 1),
"%)"
)
)
) +
labs(x=NULL,
title=mainTitle,
subtitle=paste0("Red line (right axis) is implied fatality rate\n",
"Blue line is cases with and without ",
abs(lagUse),
"-day ",
if(lagUse > 0) "lag" else "lead"
)
)
if (isTRUE(printPlots)) print(p1)
# Apply a CFR to the data and show alignment
p2 <- basePlot +
geom_line(aes(y=multDeath*dpm7), color="red") +
labs(x=NULL,
y="Per million (7-day rolling mean)",
title=mainTitle,
subtitle=paste0("Red line is ",
multDeath,
"*deaths\n",
"Blue line is cases with and without ",
abs(lagUse),
"-day ",
if(lagUse > 0) "lag" else "lead"
)
)
if (isTRUE(printPlots))print(p2)
if (isTRUE(returnPlots)) list(p1=p1, p2=p2)
}
# Run for Michigan, Florida, California
findCorrAlign(dfPivot_210804, keyState="MI", minDate="2020-08-01", returnData=TRUE) %>%
plotCFRLag(mainTitle=paste0(formals(plotCFRLag)$mainTitle, "MI"))
findCorrAlign(dfPivot_210804, keyState="FL", returnData=TRUE) %>%
plotCFRLag(mainTitle=paste0(formals(plotCFRLag)$mainTitle, "FL"), multDeath=100)
findCorrAlign(dfPivot_210804, keyState="CA", returnData=TRUE) %>%
plotCFRLag(mainTitle=paste0(formals(plotCFRLag)$mainTitle, "CA"), multDeath=70)
Functions have been updated so that plots can be returned and/or printed. A new function allows for creating all plots for state on a single page:
# Function to plot all states on the same page
onePageCFRPlot <- function(df, keyState, multDeath=100, cfrCap=0.06, ...) {
# FUNCTION ARGUMENTS:
# df: the data frame containing state-date-name-value
# keyState: the key state to be analyzed
# multDeath: multiplier for death in the death/lagged cases chart of plotCFRLag()
# ...: other arguments to be passed to findCorrAlign()
# Find the correlations data
corrData <- findCorrAlign(df,
keyState=keyState,
yLab="Value per million\n(rolling 7-day mean)",
printPlots=FALSE,
returnPlots=TRUE,
returnData=TRUE,
...
)
# Find CFR
cfrData <- plotCFRLag(corrData,
cfrCap=cfrCap,
multDeath=multDeath,
mainTitle=paste0(formals(plotCFRLag)$mainTitle, keyState),
printPlots=FALSE,
returnPlots=TRUE
)
# Create single-page summary
gridExtra::grid.arrange(corrData$p1, corrData$p2, cfrData$p1, cfrData$p2, nrow=2)
}
# Run for Michigan, Florida, California, Texas, New York, South Dakota
onePageCFRPlot(dfPivot_210804, keyState="MI", minDate="2020-08-01")
onePageCFRPlot(dfPivot_210804, keyState="FL", multDeath=100)
onePageCFRPlot(dfPivot_210804, keyState="CA", multDeath=70)
onePageCFRPlot(dfPivot_210804, keyState="TX", multDeath=70)
onePageCFRPlot(dfPivot_210804, keyState="NY", multDeath=10, cfrCap=0.1)
onePageCFRPlot(dfPivot_210804, keyState="SD", multDeath=70)
Summaries are created for vaccination status by age cohort and state:
cdc_daily_210815 <- readFromRDS("cdc_daily_210815")
# Example using hard coding and wide data
cdc_daily_210815$dfRaw$vax %>%
filter(date==max(date), state %in% c(state.abb, "DC")) %>%
select(state, contains("Administered_Dose1")) %>%
ggplot(aes(x=fct_reorder(state, Administered_Dose1_Recip_65PlusPop_Pct))) +
geom_col(aes(fill="65+", y=Administered_Dose1_Recip_65PlusPop_Pct)) +
geom_col(aes(y=Administered_Dose1_Recip_18PlusPop_Pct, fill="18+")) +
geom_col(aes(y=Administered_Dose1_Pop_Pct, fill="All")) +
geom_text(aes(y=Administered_Dose1_Recip_65PlusPop_Pct,
label=paste0(Administered_Dose1_Recip_65PlusPop_Pct, "% (", state, ")")
),
hjust=0,
size=3
) +
geom_text(aes(y=Administered_Dose1_Recip_18PlusPop_Pct+0.5,
label=paste0(Administered_Dose1_Recip_18PlusPop_Pct, "%")
),
hjust=0,
size=3
) +
coord_flip() +
labs(x=NULL,
y="% Fully Vaccinated",
title="First-dose vaccinated by age cohort and state (mid-Aug 2020)",
subtitle="Black: all population, Yellow: 18+, Blue: 65+"
) +
scale_fill_manual("Cohort",
breaks=c("All", "18+", "65+"),
values=c("65+"="lightblue", "18+"="yellow", "All"="black" )
) +
geom_text(aes(y=Administered_Dose1_Pop_Pct+0.5,
label=paste0(Administered_Dose1_Pop_Pct, "%")
),
hjust=0,
size=3
) +
theme(legend.position="bottom")
# Function for reproducibility
tempStackPlot <- function(df,
yVars,
xVar="state",
yLab="",
plotTitle="",
colorVector=c("lightblue", "grey", "orange", "black")
) {
# FUNCTION ARGUMENTS:
# df: data frame or tibble
# yVars: named vector with c("variable"="name")
# xVar: the x variable
# yLab: the y-axis label for the plot
# plotTitle: the title for the plot
# colorVector: colors to use for filled bars (sequentially, can have more, but not less, than length(yVars))
colorVector <- colorVector[1:length(yVars)]
names(colorVector) <- names(yVars)
p1 <- df %>%
select(all_of(xVar), all_of(names(yVars))) %>%
pivot_longer(-c(all_of(xVar))) %>%
ggplot(aes(x=fct_reorder(get(xVar[1]), value, max))) +
coord_flip() +
labs(x=NULL, y=yLab, title=plotTitle) +
geom_col(aes(y=value, fill=name), position="identity") +
geom_text(aes(y=value+0.5,
label=paste0(value, "%", ifelse(name==names(yVars)[1], paste0(" (", state, ")"), ""))
),
hjust=0,
size=3
) +
scale_fill_manual("Cohort",
breaks=rev(names(yVars)),
labels=rev(unname(yVars)),
values=colorVector
) +
theme(legend.position="bottom")
p1
}
# Run for fully vaccinated
tempStackPlot(cdc_daily_210815$dfRaw$vax %>% filter(date==max(date), state %in% c(state.abb, "DC")),
yVars=c("vxcgte65pct"="65+",
"vxcgte18pct"="18+",
"vxcpoppct"="All"
),
yLab="% Fully vaccinated",
plotTitle="Fully vaccinated by age cohort and state (mid-Aug 2020)"
)
# Run for first dose
tempStackPlot(cdc_daily_210815$dfRaw$vax %>% filter(date==max(date), state %in% c(state.abb, "DC")),
yVars=c("Administered_Dose1_Recip_65PlusPop_Pct"="65+",
"Administered_Dose1_Recip_18PlusPop_Pct"="18+",
"Administered_Dose1_Pop_Pct"="All"
),
yLab="% Receiving First Dose",
plotTitle="First-dose vaccinated by age cohort and state (mid-Aug 2020)"
)
The plotting is extended to show the evolution of vaccination over time:
# Create data
cdcVaxGrowth <- cdc_daily_210815$dfRaw$vax %>%
filter(date %in% c(as.Date(max(date)-lubridate::dmonths(c(0, 2, 4)), origin="1970-01-01")),
state %in% c(state.abb, "DC")
)
# Run for fuly vaccinated
p1 <- cdcVaxGrowth %>%
select(state, date, vxcpoppct) %>%
pivot_wider(state, names_from="date", values_from="vxcpoppct") %>%
tempStackPlot(yVars=c("2021-08-15"="2021-08-15",
"2021-06-15"="2021-06-15",
"2021-04-15"="2021-04-15"
),
yLab="% Fully Vaccinated (all population)",
plotTitle="Evolution of fully vaccinated rate by state"
)
p2 <- cdcVaxGrowth %>%
select(state, date, vxcgte65pct) %>%
pivot_wider(state, names_from="date", values_from="vxcgte65pct") %>%
tempStackPlot(yVars=c("2021-08-15"="2021-08-15",
"2021-06-15"="2021-06-15",
"2021-04-15"="2021-04-15"
),
yLab="% Fully Vaccinated (65+)",
plotTitle="Evolution of fully vaccinated rate by state"
)
gridExtra::grid.arrange(p1, p2, nrow=1)
# Run for first dose
p1 <- cdcVaxGrowth %>%
select(state, date, Administered_Dose1_Pop_Pct) %>%
pivot_wider(state, names_from="date", values_from="Administered_Dose1_Pop_Pct") %>%
tempStackPlot(yVars=c("2021-08-15"="2021-08-15",
"2021-06-15"="2021-06-15",
"2021-04-15"="2021-04-15"
),
yLab="% First-dose (all population)",
plotTitle="Evolution of first dose rate by state"
)
p2 <- cdcVaxGrowth %>%
select(state, date, Administered_Dose1_Recip_65PlusPop_Pct) %>%
pivot_wider(state, names_from="date", values_from="Administered_Dose1_Recip_65PlusPop_Pct") %>%
tempStackPlot(yVars=c("2021-08-15"="2021-08-15",
"2021-06-15"="2021-06-15",
"2021-04-15"="2021-04-15"
),
yLab="% First-dose (65+)",
plotTitle="Evolution of first dose rate by state"
)
gridExtra::grid.arrange(p1, p2, nrow=1)
Similar plots are created for the evolution of cases per thousand and deaths per milion:
# Updated function for reproducibility
tempStackPlot <- function(df,
yVars,
xVar="state",
yLab=NULL,
plotTitle=NULL,
colorVector=c("lightblue", "grey", "orange", "black"),
addSuffix="%",
scaleName="Cohort",
textBuffer=0.5
) {
# FUNCTION ARGUMENTS:
# df: data frame or tibble
# yVars: named vector with c("variable"="name"), in the desired order from right-most to left-most
# xVar: the x variable
# yLab: the y-axis label for the plot
# plotTitle: the title for the plot
# colorVector: colors to use for filled bars (sequentially, can have more, but not less, than length(yVars))
# addSuffix: value to be appended to all values in plots (e.g., 96 would show as 96% in the text label)
# scaleName: the name to use for the legend
# textBuffer: distance from bar to text
colorVector <- colorVector[1:length(yVars)]
names(colorVector) <- names(yVars)
p1 <- df %>%
select(all_of(xVar), all_of(names(yVars))) %>%
pivot_longer(-c(all_of(xVar))) %>%
ggplot(aes(x=fct_reorder(get(xVar[1]), value, max))) +
coord_flip() +
labs(x=NULL, y=yLab, title=plotTitle) +
geom_col(aes(y=value, fill=name), position="identity") +
geom_text(aes(y=value+textBuffer,
label=paste0(value,
addSuffix,
ifelse(name==names(yVars)[1], paste0(" (", get(xVar[1]), ")"), "")
)
),
hjust=0,
size=3
) +
scale_fill_manual(scaleName,
breaks=rev(names(yVars)),
labels=rev(unname(yVars)),
values=colorVector
) +
theme(legend.position="bottom")
p1
}
# Create data
cdcBurdenGrowth <- cdc_daily_210815$dfPerCapita %>%
filter(date %in% c(as.Date(max(date)-2-lubridate::dmonths(c(0, 6, 12)), origin="1970-01-01")),
state %in% c(state.abb, "DC")
)
# Run for cases
p1 <- cdcBurdenGrowth %>%
select(state, date, tcpm) %>%
mutate(tcpm=round(tcpm/1000)) %>%
pivot_wider(state, names_from="date", values_from="tcpm") %>%
tempStackPlot(yVars=c("2021-08-13"="2021-08-13",
"2021-02-11"="2021-02-11",
"2020-08-12"="2020-08-12"
),
yLab="Cumulative cases per thousand",
plotTitle="Evolution of cumulative cases per thousand by state",
addSuffix="",
scaleName="Date"
)
# Run for deaths
p2 <- cdcBurdenGrowth %>%
select(state, date, tdpm) %>%
mutate(tdpm=round(tdpm)) %>%
pivot_wider(state, names_from="date", values_from="tdpm") %>%
tempStackPlot(yVars=c("2021-08-13"="2021-08-13",
"2021-02-11"="2021-02-11",
"2020-08-12"="2020-08-12"
),
yLab="Cumulative deaths per million",
plotTitle="Evolution of cumulative deaths per million by state",
addSuffix="",
scaleName="Date"
)
gridExtra::grid.arrange(p1, p2, nrow=1)
The latest data as of August 31 are downloaded and processed, with caching to avoid multiple file downloads:
readList <- list("cdcDaily"="./RInputFiles/Coronavirus/CDC_dc_downloaded_210902.csv",
"cdcHosp"="./RInputFiles/Coronavirus/CDC_h_downloaded_210902.csv",
"vax"="./RInputFiles/Coronavirus/vaxData_downloaded_210902.csv"
)
compareList <- list("cdcDaily"=readFromRDS("cdc_daily_210804")$dfRaw$cdcDaily,
"cdcHosp"=readFromRDS("cdc_daily_210804")$dfRaw$cdcHosp,
"vax"=readFromRDS("cdc_daily_210804")$dfRaw$vax
)
cdc_daily_210902 <- readRunCDCDaily(thruLabel="Sep 1, 2021",
downloadTo=lapply(readList, FUN=function(x) if(file.exists(x)) NA else x),
readFrom=readList,
compareFile=compareList,
writeLog=NULL,
useClusters=readFromRDS("cdc_daily_210528")$useClusters,
weightedMeanAggs=c("tcpm7", "tdpm7", "cpm7", "dpm7", "hpm7",
"vxcpm7", "vxcgte65pct"
),
skipAssessmentPlots=FALSE,
brewPalette="Paired"
)
##
## No file has been downloaded, will use existing file: ./RInputFiles/Coronavirus/CDC_dc_downloaded_210902.csv
##
## -- Column specification --------------------------------------------------------
## cols(
## submission_date = col_character(),
## state = col_character(),
## tot_cases = col_double(),
## conf_cases = col_double(),
## prob_cases = col_double(),
## new_case = col_double(),
## pnew_case = col_double(),
## tot_death = col_double(),
## conf_death = col_double(),
## prob_death = col_double(),
## new_death = col_double(),
## pnew_death = col_double(),
## created_at = col_character(),
## consent_cases = col_character(),
## consent_deaths = col_character()
## )
##
## *** File has been checked for uniqueness by: state date
##
##
## Checking for similarity of: column names
## In reference but not in current:
## In current but not in reference:
##
## Checking for similarity of: date
## In reference but not in current: 0
## In current but not in reference: 29
##
## Checking for similarity of: state
## In reference but not in current:
## In current but not in reference:
##
##
## ***Differences of at least 5 and at least 5%
##
## date name newValue refValue absDelta pctDelta
## 1 2020-02-02 tot_deaths 0 143 143 2.00000000
## 2 2020-02-03 tot_deaths 178 143 35 0.21806854
## 3 2020-02-04 tot_deaths 178 143 35 0.21806854
## 4 2020-02-05 tot_deaths 178 143 35 0.21806854
## 5 2020-02-06 tot_deaths 178 143 35 0.21806854
## 6 2020-02-07 tot_deaths 178 143 35 0.21806854
## 7 2020-02-08 tot_deaths 179 144 35 0.21671827
## 8 2020-02-09 tot_deaths 179 144 35 0.21671827
## 9 2020-02-10 tot_deaths 179 144 35 0.21671827
## 10 2020-02-11 tot_deaths 179 144 35 0.21671827
## 11 2020-02-12 tot_deaths 179 144 35 0.21671827
## 12 2020-02-13 tot_deaths 179 144 35 0.21671827
## 13 2020-02-14 tot_deaths 179 144 35 0.21671827
## 14 2020-02-15 tot_deaths 179 144 35 0.21671827
## 15 2020-02-16 tot_deaths 179 144 35 0.21671827
## 16 2020-02-17 tot_deaths 179 144 35 0.21671827
## 17 2020-02-18 tot_deaths 179 144 35 0.21671827
## 18 2020-02-19 tot_deaths 180 145 35 0.21538462
## 19 2020-02-20 tot_deaths 180 145 35 0.21538462
## 20 2020-02-21 tot_deaths 180 145 35 0.21538462
## 21 2020-02-22 tot_deaths 180 145 35 0.21538462
## 22 2020-02-23 tot_deaths 180 145 35 0.21538462
## 23 2020-02-24 tot_deaths 180 145 35 0.21538462
## 24 2020-02-25 tot_deaths 180 145 35 0.21538462
## 25 2020-02-26 tot_deaths 180 145 35 0.21538462
## 26 2020-02-27 tot_deaths 181 146 35 0.21406728
## 27 2020-02-28 tot_deaths 181 146 35 0.21406728
## 28 2020-02-29 tot_deaths 182 147 35 0.21276596
## 29 2020-03-01 tot_deaths 182 147 35 0.21276596
## 30 2020-03-02 tot_deaths 188 153 35 0.20527859
## 31 2020-03-06 tot_deaths 200 163 37 0.20385675
## 32 2020-03-05 tot_deaths 196 160 36 0.20224719
## 33 2020-03-03 tot_deaths 191 156 35 0.20172911
## 34 2020-03-04 tot_deaths 193 158 35 0.19943020
## 35 2020-03-07 tot_deaths 205 168 37 0.19839142
## 36 2020-03-08 tot_deaths 210 173 37 0.19321149
## 37 2020-03-10 tot_deaths 220 184 36 0.17821782
## 38 2020-03-09 tot_deaths 214 179 35 0.17811705
## 39 2020-03-11 tot_deaths 234 198 36 0.16666667
## 40 2020-03-12 tot_deaths 241 205 36 0.16143498
## 41 2020-03-13 tot_deaths 252 216 36 0.15384615
## 42 2020-03-14 tot_deaths 266 229 37 0.14949495
## 43 2020-03-15 tot_deaths 286 249 37 0.13831776
## 44 2020-03-16 tot_deaths 307 271 36 0.12456747
## 45 2020-03-17 tot_deaths 339 301 38 0.11875000
## 46 2020-03-18 tot_deaths 410 373 37 0.09450830
## 47 2020-03-20 tot_deaths 577 530 47 0.08491418
## 48 2020-03-19 tot_deaths 475 437 38 0.08333333
## 49 2020-03-21 tot_deaths 692 644 48 0.07185629
## 50 2020-03-22 tot_deaths 827 775 52 0.06491885
## 51 2020-03-25 tot_deaths 1544 1459 85 0.05661006
## 52 2020-03-24 tot_deaths 1232 1165 67 0.05590321
## 53 2020-03-23 tot_deaths 998 946 52 0.05349794
## 54 2020-03-26 tot_deaths 1897 1804 93 0.05025669
## 55 2020-02-02 tot_cases 56 510 454 1.60424028
## 56 2021-07-25 new_deaths 261 136 125 0.62972292
## 57 2021-07-24 new_deaths 287 162 125 0.55679287
## 58 2021-07-18 new_deaths 166 96 70 0.53435115
## 59 2021-07-23 new_deaths 388 226 162 0.52768730
## 60 2021-08-01 new_deaths 363 240 123 0.40796020
## 61 2021-07-26 new_deaths 368 245 123 0.40130506
## 62 2021-06-08 new_deaths 313 209 104 0.39846743
## 63 2021-06-07 new_deaths 339 500 161 0.38379023
## 64 2020-11-11 new_deaths 1516 1046 470 0.36690086
## 65 2021-07-31 new_deaths 397 274 123 0.36661699
## 66 2021-07-17 new_deaths 196 138 58 0.34730539
## 67 2021-07-19 new_deaths 256 185 71 0.32199546
## 68 2020-11-12 new_deaths 1366 1863 497 0.30783524
## 69 2020-11-10 new_deaths 1310 1761 451 0.29371540
## 70 2021-08-02 new_deaths 523 392 131 0.28633880
## 71 2021-07-05 new_deaths 141 106 35 0.28340081
## 72 2021-07-04 new_deaths 131 101 30 0.25862069
## 73 2021-06-17 new_deaths 268 334 66 0.21926910
## 74 2021-07-28 new_deaths 443 356 87 0.21777222
## 75 2021-07-29 new_deaths 460 370 90 0.21686747
## 76 2021-05-31 new_deaths 268 218 50 0.20576132
## 77 2020-09-30 new_deaths 537 660 123 0.20551378
## 78 2021-07-12 new_deaths 227 186 41 0.19854722
## 79 2021-06-13 new_deaths 167 200 33 0.17983651
## 80 2020-10-11 new_deaths 565 675 110 0.17741935
## 81 2021-06-21 new_deaths 265 315 50 0.17241379
## 82 2021-07-15 new_deaths 298 251 47 0.17122040
## 83 2020-07-13 new_deaths 869 732 137 0.17114304
## 84 2021-07-11 new_deaths 140 118 22 0.17054264
## 85 2021-07-10 new_deaths 153 129 24 0.17021277
## 86 2021-07-27 new_deaths 464 393 71 0.16569428
## 87 2020-10-08 new_deaths 681 803 122 0.16442049
## 88 2021-06-14 new_deaths 221 260 39 0.16216216
## 89 2021-07-20 new_deaths 316 269 47 0.16068376
## 90 2021-07-06 new_deaths 203 173 30 0.15957447
## 91 2021-06-01 new_deaths 334 391 57 0.15724138
## 92 2020-09-24 new_deaths 694 812 118 0.15670651
## 93 2020-07-26 new_deaths 937 802 135 0.15526164
## 94 2020-09-07 new_deaths 557 477 80 0.15473888
## 95 2021-07-22 new_deaths 331 386 55 0.15341702
## 96 2020-08-02 new_deaths 919 789 130 0.15222482
## 97 2020-09-23 new_deaths 812 944 132 0.15034169
## 98 2020-08-30 new_deaths 638 552 86 0.14453782
## 99 2021-04-11 new_deaths 428 371 57 0.14267835
## 100 2021-07-16 new_deaths 301 261 40 0.14234875
## 101 2020-09-10 new_deaths 789 908 119 0.14024750
## 102 2021-07-09 new_deaths 268 233 35 0.13972056
## 103 2020-07-12 new_deaths 865 753 112 0.13844252
## 104 2020-09-13 new_deaths 713 623 90 0.13473054
## 105 2021-06-19 new_deaths 206 180 26 0.13471503
## 106 2021-05-29 new_deaths 351 307 44 0.13373860
## 107 2020-10-15 new_deaths 693 792 99 0.13333333
## 108 2020-09-09 new_deaths 840 959 119 0.13229572
## 109 2020-09-06 new_deaths 661 580 81 0.13053989
## 110 2020-09-20 new_deaths 473 416 57 0.12823397
## 111 2020-08-09 new_deaths 856 756 100 0.12406948
## 112 2020-07-19 new_deaths 981 869 112 0.12108108
## 113 2021-03-26 new_deaths 844 951 107 0.11922006
## 114 2021-07-03 new_deaths 160 142 18 0.11920530
## 115 2021-07-07 new_deaths 239 269 30 0.11811024
## 116 2021-06-24 new_deaths 255 287 32 0.11808118
## 117 2020-08-17 new_deaths 834 742 92 0.11675127
## 118 2020-07-20 new_deaths 1028 915 113 0.11631498
## 119 2020-09-28 new_deaths 518 462 56 0.11428571
## 120 2020-08-04 new_deaths 1217 1087 130 0.11284722
## 121 2020-07-27 new_deaths 1115 997 118 0.11174242
## 122 2020-09-17 new_deaths 698 778 80 0.10840108
## 123 2021-06-04 new_deaths 522 469 53 0.10696266
## 124 2020-07-25 new_deaths 1153 1036 117 0.10689813
## 125 2021-06-12 new_deaths 298 268 30 0.10600707
## 126 2020-07-05 new_deaths 571 514 57 0.10506912
## 127 2020-07-06 new_deaths 716 645 71 0.10433505
## 128 2021-05-30 new_deaths 263 237 26 0.10400000
## 129 2020-09-11 new_deaths 797 884 87 0.10350982
## 130 2021-06-05 new_deaths 319 288 31 0.10214168
## 131 2020-07-09 new_deaths 883 798 85 0.10113028
## 132 2021-05-27 new_deaths 508 561 53 0.09915809
## 133 2020-09-21 new_deaths 657 596 61 0.09736632
## 134 2020-09-18 new_deaths 773 852 79 0.09723077
## 135 2020-07-04 new_deaths 572 519 53 0.09715857
## 136 2020-09-16 new_deaths 985 1085 100 0.09661836
## 137 2021-06-06 new_deaths 225 247 22 0.09322034
## 138 2020-08-06 new_deaths 1236 1126 110 0.09314141
## 139 2020-07-18 new_deaths 1001 912 89 0.09304757
## 140 2020-03-20 new_deaths 102 93 9 0.09230769
## 141 2020-10-09 new_deaths 745 816 71 0.09096733
## 142 2020-06-22 new_deaths 583 533 50 0.08960573
## 143 2021-07-01 new_deaths 216 236 20 0.08849558
## 144 2020-10-01 new_deaths 704 768 64 0.08695652
## 145 2021-06-20 new_deaths 193 177 16 0.08648649
## 146 2020-08-23 new_deaths 753 692 61 0.08442907
## 147 2021-06-30 new_deaths 247 227 20 0.08438819
## 148 2020-10-10 new_deaths 656 603 53 0.08419380
## 149 2020-09-15 new_deaths 793 862 69 0.08338369
## 150 2020-10-13 new_deaths 741 805 64 0.08279431
## 151 2021-07-02 new_deaths 265 244 21 0.08251473
## 152 2021-06-18 new_deaths 228 210 18 0.08219178
## 153 2020-08-24 new_deaths 779 718 61 0.08149633
## 154 2021-05-20 new_deaths 498 540 42 0.08092486
## 155 2021-05-25 new_deaths 491 532 41 0.08015640
## 156 2020-09-01 new_deaths 960 1040 80 0.08000000
## 157 2020-09-03 new_deaths 882 954 72 0.07843137
## 158 2021-06-15 new_deaths 311 336 25 0.07727975
## 159 2021-03-25 new_deaths 762 823 61 0.07697161
## 160 2020-09-27 new_deaths 489 453 36 0.07643312
## 161 2020-09-12 new_deaths 599 646 47 0.07550201
## 162 2020-08-31 new_deaths 688 638 50 0.07541478
## 163 2020-09-25 new_deaths 705 760 55 0.07508532
## 164 2020-06-14 new_deaths 491 456 35 0.07391763
## 165 2020-07-17 new_deaths 1097 1020 77 0.07274445
## 166 2020-08-18 new_deaths 1034 1112 78 0.07269338
## 167 2020-09-29 new_deaths 862 927 65 0.07266629
## 168 2020-07-24 new_deaths 1337 1244 93 0.07206509
## 169 2021-06-26 new_deaths 188 175 13 0.07162534
## 170 2020-10-07 new_deaths 791 849 58 0.07073171
## 171 2021-02-16 new_deaths 1579 1694 115 0.07027192
## 172 2021-06-28 new_deaths 207 193 14 0.07000000
## 173 2020-10-25 new_deaths 654 610 44 0.06962025
## 174 2021-04-16 new_deaths 755 809 54 0.06905371
## 175 2021-05-09 new_deaths 383 358 25 0.06747638
## 176 2021-03-14 new_deaths 635 594 41 0.06672091
## 177 2021-03-30 new_deaths 725 775 50 0.06666667
## 178 2021-04-05 new_deaths 404 378 26 0.06649616
## 179 2020-03-24 new_deaths 234 219 15 0.06622517
## 180 2020-07-15 new_deaths 1171 1096 75 0.06616674
## 181 2021-06-16 new_deaths 331 310 21 0.06552262
## 182 2020-09-14 new_deaths 538 504 34 0.06525912
## 183 2021-05-18 new_deaths 615 656 41 0.06451613
## 184 2020-07-21 new_deaths 1332 1251 81 0.06271777
## 185 2021-05-04 new_deaths 698 743 45 0.06245663
## 186 2021-05-21 new_deaths 590 628 38 0.06239737
## 187 2020-08-14 new_deaths 1011 1076 65 0.06229037
## 188 2020-08-25 new_deaths 975 1037 62 0.06163022
## 189 2020-12-25 new_deaths 2489 2341 148 0.06128364
## 190 2021-07-30 new_deaths 488 459 29 0.06124604
## 191 2020-10-21 new_deaths 1046 1112 66 0.06116775
## 192 2020-07-11 new_deaths 880 828 52 0.06088993
## 193 2021-04-26 new_deaths 496 527 31 0.06060606
## 194 2020-08-01 new_deaths 1144 1077 67 0.06033318
## 195 2021-06-02 new_deaths 472 501 29 0.05960946
## 196 2020-03-25 new_deaths 312 294 18 0.05940594
## 197 2021-05-26 new_deaths 497 527 30 0.05859375
## 198 2020-06-21 new_deaths 406 383 23 0.05830165
## 199 2021-01-01 new_deaths 3181 3001 180 0.05823358
## 200 2021-04-25 new_deaths 425 401 24 0.05811138
## 201 2020-08-22 new_deaths 898 848 50 0.05727377
## 202 2020-10-17 new_deaths 666 705 39 0.05689278
## 203 2021-06-27 new_deaths 147 139 8 0.05594406
## 204 2020-08-28 new_deaths 950 899 51 0.05516495
## 205 2021-04-06 new_deaths 726 767 41 0.05492297
## 206 2020-08-20 new_deaths 974 922 52 0.05485232
## 207 2020-10-02 new_deaths 772 815 43 0.05419030
## 208 2021-05-02 new_deaths 408 387 21 0.05283019
## 209 2021-04-08 new_deaths 741 781 40 0.05256242
## 210 2020-07-22 new_deaths 1204 1143 61 0.05198125
## 211 2020-06-29 new_deaths 537 510 27 0.05157593
## 212 2021-03-16 new_deaths 889 936 47 0.05150685
## 213 2021-02-19 new_deaths 2138 2251 113 0.05149237
## 214 2021-05-16 new_deaths 419 398 21 0.05140759
## 215 2021-06-10 new_deaths 381 401 20 0.05115090
## 216 2021-04-19 new_deaths 503 478 25 0.05096840
## 217 2020-06-27 new_deaths 585 556 29 0.05083260
## 218 2020-05-04 new_deaths 1341 1275 66 0.05045872
## 219 2021-07-21 new_deaths 387 407 20 0.05037783
## 220 2021-03-09 new_deaths 1067 1122 55 0.05025126
## 221 2020-11-07 new_cases 131351 95671 35680 0.31433077
## 222 2021-07-29 new_cases 100196 83462 16734 0.18223001
## 223 2020-08-31 new_cases 36964 31737 5227 0.15216664
## 224 2021-07-26 new_cases 58003 51051 6952 0.12749647
## 225 2021-07-28 new_cases 95770 84435 11335 0.12580117
## 226 2020-09-01 new_cases 39422 44538 5116 0.12186756
## 227 2021-07-27 new_cases 87274 77663 9611 0.11654147
## 228 2021-03-01 new_cases 51474 45900 5574 0.11448641
## 229 2021-06-06 new_cases 10806 12103 1297 0.11323061
## 230 2021-07-06 new_cases 16808 15036 1772 0.11129255
## 231 2021-06-28 new_cases 10809 9695 1114 0.10866172
## 232 2021-04-12 new_cases 60933 54867 6066 0.10476684
## 233 2021-01-02 new_cases 202831 223976 21145 0.09908460
## 234 2021-07-20 new_cases 53097 48234 4863 0.09598247
## 235 2020-07-05 new_cases 41454 45432 3978 0.09156826
## 236 2020-10-11 new_cases 43907 47898 3991 0.08694516
## 237 2020-12-26 new_cases 139718 151877 12159 0.08339649
## 238 2021-07-31 new_cases 93001 85965 7036 0.07862946
## 239 2021-04-18 new_cases 47829 51724 3895 0.07824978
## 240 2020-06-25 new_cases 52896 48970 3926 0.07708166
## 241 2020-10-10 new_cases 54532 50606 3926 0.07468280
## 242 2021-05-22 new_cases 21567 23239 1672 0.07463286
## 243 2020-05-28 new_cases 25872 24023 1849 0.07411564
## 244 2021-04-11 new_cases 49741 53464 3723 0.07214767
## 245 2021-07-12 new_cases 24378 22694 1684 0.07154997
## 246 2020-11-26 new_cases 154983 166180 11197 0.06972783
## 247 2020-07-11 new_cases 71048 66320 4728 0.06883699
## 248 2020-06-28 new_cases 42359 45369 3010 0.06862119
## 249 2020-07-13 new_cases 54767 58407 3640 0.06432573
## 250 2021-07-19 new_cases 37518 35205 2313 0.06361124
## 251 2021-02-28 new_cases 48809 51996 3187 0.06323099
## 252 2020-07-15 new_cases 74721 70325 4396 0.06061525
## 253 2021-06-05 new_cases 14629 15543 914 0.06058597
## 254 2020-10-04 new_cases 34481 36560 2079 0.05852958
## 255 2020-07-07 new_cases 61055 57638 3417 0.05757711
## 256 2020-08-09 new_cases 41301 43702 2401 0.05649212
## 257 2020-05-21 new_cases 26310 27823 1513 0.05589936
## 258 2021-06-25 new_cases 14346 13571 775 0.05552173
## 259 2021-07-24 new_cases 61423 58168 3255 0.05443553
## 260 2021-02-15 new_cases 55391 52487 2904 0.05383860
## 261 2021-04-24 new_cases 52189 55068 2879 0.05368414
## 262 2020-08-15 new_cases 44136 46541 2405 0.05304542
## 263 2020-07-19 new_cases 58071 61214 3143 0.05269732
## 264 2020-10-21 new_cases 73143 69480 3663 0.05136619
## 265 2020-07-01 new_cases 62056 58987 3069 0.05070925
##
##
## ***Differences of at least 0 and at least 0.1%
##
## state name newValue refValue absDelta pctDelta
## 1 FL tot_deaths 10350041 9728382 621659 0.061923090
## 2 PR tot_deaths 628469 609082 19387 0.031331234
## 3 KY tot_deaths 1849448 1839137 10311 0.005590762
## 4 IN tot_deaths 3811948 3798160 13788 0.003623602
## 5 MS tot_deaths 2215491 2207767 7724 0.003492448
## 6 AL tot_deaths 3073211 3066125 7086 0.002308393
## 7 SC tot_deaths 2563582 2568618 5036 0.001962511
## 8 NM tot_deaths 1126633 1124549 2084 0.001851472
## 9 NC tot_deaths 3458165 3454115 4050 0.001171828
## 10 PR tot_cases 31617012 33334437 1717425 0.052883347
## 11 PA tot_cases 273389806 270659767 2730039 0.010035994
## 12 AL tot_cases 147055558 148145611 1090053 0.007385154
## 13 SC tot_cases 145835188 146346674 511486 0.003501148
## 14 FL tot_cases 578444524 576560229 1884295 0.003262835
## 15 MI tot_cases 242865368 242316039 549329 0.002264427
## 16 FL new_deaths 40473 39179 1294 0.032491337
## 17 MS new_deaths 7791 7544 247 0.032213890
## 18 GA new_deaths 21232 21698 466 0.021709760
## 19 KY new_deaths 7479 7348 131 0.017670466
## 20 AL new_deaths 11734 11542 192 0.016497680
## 21 NM new_deaths 4446 4414 32 0.007223476
## 22 NC new_deaths 13739 13670 69 0.005034843
## 23 IN new_deaths 14058 14012 46 0.003277520
## 24 TN new_deaths 12794 12758 36 0.002817783
## 25 PR new_deaths 2591 2585 6 0.002318393
## 26 SC new_deaths 9972 9958 14 0.001404917
## 27 AL new_cases 599948 592417 7531 0.012632038
## 28 CA new_cases 4074510 4037808 36702 0.009048462
## 29 NC new_cases 1064603 1056699 7904 0.007452027
## 30 WA new_cases 479286 475881 3405 0.007129643
## 31 FL new_cases 2659034 2641696 17338 0.006541740
## 32 KY new_cases 488696 486115 2581 0.005295385
## 33 GA new_cases 1190936 1185594 5342 0.004495630
## 34 MI new_cases 1017675 1013112 4563 0.004493824
## 35 PA new_cases 1232900 1227519 5381 0.004374052
## 36 TN new_cases 903587 900418 3169 0.003513294
## 37 SD new_cases 125481 125216 265 0.002114106
## 38 PR new_cases 148067 147820 247 0.001669556
## 39 SC new_cases 624678 623861 817 0.001308730
##
##
##
## Raw file for cdcDaily:
## Rows: 35,280
## Columns: 15
## $ date <date> 2021-01-25, 2020-04-17, 2021-02-02, 2020-07-30, 2020-0~
## $ state <chr> "NE", "VI", "IL", "ME", "WI", "ND", "GU", "CT", "WI", "~
## $ tot_cases <dbl> 187923, 54, 1130917, 3910, 25480, 6602, 0, 267337, 9844~
## $ conf_cases <dbl> NA, NA, 1130917, 3497, 22932, 6602, NA, 250915, 92712, ~
## $ prob_cases <dbl> NA, NA, 0, 413, 2548, 0, NA, 16422, 5728, NA, 123700, N~
## $ new_cases <dbl> 646, 1, 2304, 22, 185, 133, 0, 0, 1502, 128, 502, 0, 39~
## $ pnew_case <dbl> 0, NA, 0, 2, 11, 0, NA, 0, 94, 0, 143, NA, 5, 154, 0, 0~
## $ tot_deaths <dbl> 1894, 2, 21336, 123, 700, 103, 0, 7381, 1237, 5586, 111~
## $ conf_death <dbl> NA, NA, 19306, 122, 694, NA, NA, 6049, 1228, NA, 8887, ~
## $ prob_death <dbl> NA, NA, 2030, 1, 6, NA, NA, 1332, 9, NA, 2265, NA, NA, ~
## $ new_deaths <dbl> 15, 1, 63, 2, 2, 0, 0, 0, 8, 0, 6, 0, 32, 30, 15, 18, 2~
## $ pnew_death <dbl> 0, NA, 16, 0, 0, 0, NA, 0, 0, 0, 1, NA, 0, 4, 0, 0, 0, ~
## $ created_at <chr> "01/27/2021 12:00:00 AM", "04/17/2020 04:22:39 PM", "02~
## $ consent_cases <chr> "Not agree", NA, "Agree", "Agree", "Agree", "Agree", "N~
## $ consent_deaths <chr> "Not agree", NA, "Agree", "Agree", "Agree", "Not agree"~
##
## No file has been downloaded, will use existing file: ./RInputFiles/Coronavirus/CDC_h_downloaded_210902.csv
##
## -- Column specification --------------------------------------------------------
## cols(
## .default = col_double(),
## state = col_character(),
## date = col_date(format = ""),
## geocoded_state = col_logical()
## )
## i Use `spec()` for the full column specifications.
##
## *** File has been checked for uniqueness by: state date
##
##
## Checking for similarity of: column names
## In reference but not in current:
## In current but not in reference:
##
## Checking for similarity of: date
## In reference but not in current: 0
## In current but not in reference: 32
##
## Checking for similarity of: state
## In reference but not in current:
## In current but not in reference:
##
##
## ***Differences of at least 5 and at least 5%
##
## date name newValue refValue absDelta pctDelta
## 1 2021-07-02 inp 18509 17110 1399 0.07855358
## 2 2021-07-31 inp 51488 48807 2681 0.05346229
## 3 2020-07-25 hosp_ped 3450 4610 1160 0.28784119
## 4 2020-08-02 hosp_ped 4092 4498 406 0.09452852
## 5 2021-07-31 hosp_ped 1313 1247 66 0.05156250
## 6 2021-07-02 hosp_ped 696 662 34 0.05007364
## 7 2021-07-02 hosp_adult 17813 16448 1365 0.07968244
## 8 2021-07-31 hosp_adult 50175 47560 2615 0.05351205
##
##
## ***Differences of at least 0 and at least 0.1%
##
## state name newValue refValue absDelta pctDelta
## 1 AL inp 544475 542977 1498 0.002755064
## 2 TX inp 2869774 2864342 5432 0.001894625
## 3 NC inp 675079 673836 1243 0.001842963
## 4 PR inp 153817 153545 272 0.001769900
## 5 NH hosp_ped 330 285 45 0.146341463
## 6 ME hosp_ped 467 516 49 0.099694812
## 7 VI hosp_ped 31 33 2 0.062500000
## 8 KY hosp_ped 5435 5760 325 0.058061635
## 9 KS hosp_ped 1718 1819 101 0.057110546
## 10 DE hosp_ped 1826 1754 72 0.040223464
## 11 NV hosp_ped 2279 2190 89 0.039829940
## 12 AR hosp_ped 6174 6372 198 0.031563845
## 13 WV hosp_ped 2221 2289 68 0.030155211
## 14 IN hosp_ped 7226 7418 192 0.026222344
## 15 NM hosp_ped 3202 3279 77 0.023761765
## 16 ID hosp_ped 1422 1389 33 0.023479189
## 17 MA hosp_ped 5244 5129 115 0.022172949
## 18 AZ hosp_ped 11698 11884 186 0.015774743
## 19 SC hosp_ped 2805 2843 38 0.013456091
## 20 VA hosp_ped 6956 6870 86 0.012440330
## 21 MO hosp_ped 16702 16901 199 0.011844181
## 22 IA hosp_ped 2469 2441 28 0.011405295
## 23 TN hosp_ped 8139 8223 84 0.010267693
## 24 UT hosp_ped 3369 3337 32 0.009543692
## 25 MS hosp_ped 4255 4295 40 0.009356725
## 26 AL hosp_ped 8314 8385 71 0.008503503
## 27 CO hosp_ped 9706 9784 78 0.008004105
## 28 MD hosp_ped 5209 5241 32 0.006124402
## 29 SD hosp_ped 2503 2489 14 0.005608974
## 30 PR hosp_ped 11806 11868 62 0.005237814
## 31 LA hosp_ped 3659 3676 17 0.004635310
## 32 FL hosp_ped 56499 56703 204 0.003604177
## 33 OH hosp_ped 28273 28343 70 0.002472799
## 34 TX hosp_ped 41536 41439 97 0.002338054
## 35 OK hosp_ped 12409 12436 27 0.002173476
## 36 CT hosp_ped 2467 2462 5 0.002028809
## 37 OR hosp_ped 3144 3150 6 0.001906578
## 38 WA hosp_ped 4613 4621 8 0.001732727
## 39 CA hosp_ped 32309 32259 50 0.001548755
## 40 IL hosp_ped 20519 20548 29 0.001412326
## 41 RI hosp_ped 1454 1452 2 0.001376462
## 42 GA hosp_ped 22950 22921 29 0.001264415
## 43 NJ hosp_ped 9322 9311 11 0.001180701
## 44 AL hosp_adult 463714 462110 1604 0.003465021
## 45 PR hosp_adult 120801 120467 334 0.002768705
## 46 TX hosp_adult 2415904 2411369 4535 0.001878908
## 47 VI hosp_adult 1703 1700 3 0.001763150
## 48 KY hosp_adult 310588 310043 545 0.001756277
## 49 ME hosp_adult 38523 38476 47 0.001220795
##
##
##
## Raw file for cdcHosp:
## Rows: 29,378
## Columns: 99
## $ state <chr> ~
## $ date <date> ~
## $ critical_staffing_shortage_today_yes <dbl> ~
## $ critical_staffing_shortage_today_no <dbl> ~
## $ critical_staffing_shortage_today_not_reported <dbl> ~
## $ critical_staffing_shortage_anticipated_within_week_yes <dbl> ~
## $ critical_staffing_shortage_anticipated_within_week_no <dbl> ~
## $ critical_staffing_shortage_anticipated_within_week_not_reported <dbl> ~
## $ hospital_onset_covid <dbl> ~
## $ hospital_onset_covid_coverage <dbl> ~
## $ inpatient_beds <dbl> ~
## $ inpatient_beds_coverage <dbl> ~
## $ inpatient_beds_used <dbl> ~
## $ inpatient_beds_used_coverage <dbl> ~
## $ inp <dbl> ~
## $ inpatient_beds_used_covid_coverage <dbl> ~
## $ previous_day_admission_adult_covid_confirmed <dbl> ~
## $ previous_day_admission_adult_covid_confirmed_coverage <dbl> ~
## $ previous_day_admission_adult_covid_suspected <dbl> ~
## $ previous_day_admission_adult_covid_suspected_coverage <dbl> ~
## $ previous_day_admission_pediatric_covid_confirmed <dbl> ~
## $ previous_day_admission_pediatric_covid_confirmed_coverage <dbl> ~
## $ previous_day_admission_pediatric_covid_suspected <dbl> ~
## $ previous_day_admission_pediatric_covid_suspected_coverage <dbl> ~
## $ staffed_adult_icu_bed_occupancy <dbl> ~
## $ staffed_adult_icu_bed_occupancy_coverage <dbl> ~
## $ staffed_icu_adult_patients_confirmed_and_suspected_covid <dbl> ~
## $ staffed_icu_adult_patients_confirmed_and_suspected_covid_coverage <dbl> ~
## $ staffed_icu_adult_patients_confirmed_covid <dbl> ~
## $ staffed_icu_adult_patients_confirmed_covid_coverage <dbl> ~
## $ hosp_adult <dbl> ~
## $ total_adult_patients_hospitalized_confirmed_and_suspected_covid_coverage <dbl> ~
## $ total_adult_patients_hospitalized_confirmed_covid <dbl> ~
## $ total_adult_patients_hospitalized_confirmed_covid_coverage <dbl> ~
## $ hosp_ped <dbl> ~
## $ total_pediatric_patients_hospitalized_confirmed_and_suspected_covid_coverage <dbl> ~
## $ total_pediatric_patients_hospitalized_confirmed_covid <dbl> ~
## $ total_pediatric_patients_hospitalized_confirmed_covid_coverage <dbl> ~
## $ total_staffed_adult_icu_beds <dbl> ~
## $ total_staffed_adult_icu_beds_coverage <dbl> ~
## $ inpatient_beds_utilization <dbl> ~
## $ inpatient_beds_utilization_coverage <dbl> ~
## $ inpatient_beds_utilization_numerator <dbl> ~
## $ inpatient_beds_utilization_denominator <dbl> ~
## $ percent_of_inpatients_with_covid <dbl> ~
## $ percent_of_inpatients_with_covid_coverage <dbl> ~
## $ percent_of_inpatients_with_covid_numerator <dbl> ~
## $ percent_of_inpatients_with_covid_denominator <dbl> ~
## $ inpatient_bed_covid_utilization <dbl> ~
## $ inpatient_bed_covid_utilization_coverage <dbl> ~
## $ inpatient_bed_covid_utilization_numerator <dbl> ~
## $ inpatient_bed_covid_utilization_denominator <dbl> ~
## $ adult_icu_bed_covid_utilization <dbl> ~
## $ adult_icu_bed_covid_utilization_coverage <dbl> ~
## $ adult_icu_bed_covid_utilization_numerator <dbl> ~
## $ adult_icu_bed_covid_utilization_denominator <dbl> ~
## $ adult_icu_bed_utilization <dbl> ~
## $ adult_icu_bed_utilization_coverage <dbl> ~
## $ adult_icu_bed_utilization_numerator <dbl> ~
## $ adult_icu_bed_utilization_denominator <dbl> ~
## $ geocoded_state <lgl> ~
## $ `previous_day_admission_adult_covid_confirmed_18-19` <dbl> ~
## $ `previous_day_admission_adult_covid_confirmed_18-19_coverage` <dbl> ~
## $ `previous_day_admission_adult_covid_confirmed_20-29` <dbl> ~
## $ `previous_day_admission_adult_covid_confirmed_20-29_coverage` <dbl> ~
## $ `previous_day_admission_adult_covid_confirmed_30-39` <dbl> ~
## $ `previous_day_admission_adult_covid_confirmed_30-39_coverage` <dbl> ~
## $ `previous_day_admission_adult_covid_confirmed_40-49` <dbl> ~
## $ `previous_day_admission_adult_covid_confirmed_40-49_coverage` <dbl> ~
## $ `previous_day_admission_adult_covid_confirmed_50-59` <dbl> ~
## $ `previous_day_admission_adult_covid_confirmed_50-59_coverage` <dbl> ~
## $ `previous_day_admission_adult_covid_confirmed_60-69` <dbl> ~
## $ `previous_day_admission_adult_covid_confirmed_60-69_coverage` <dbl> ~
## $ `previous_day_admission_adult_covid_confirmed_70-79` <dbl> ~
## $ `previous_day_admission_adult_covid_confirmed_70-79_coverage` <dbl> ~
## $ `previous_day_admission_adult_covid_confirmed_80+` <dbl> ~
## $ `previous_day_admission_adult_covid_confirmed_80+_coverage` <dbl> ~
## $ previous_day_admission_adult_covid_confirmed_unknown <dbl> ~
## $ previous_day_admission_adult_covid_confirmed_unknown_coverage <dbl> ~
## $ `previous_day_admission_adult_covid_suspected_18-19` <dbl> ~
## $ `previous_day_admission_adult_covid_suspected_18-19_coverage` <dbl> ~
## $ `previous_day_admission_adult_covid_suspected_20-29` <dbl> ~
## $ `previous_day_admission_adult_covid_suspected_20-29_coverage` <dbl> ~
## $ `previous_day_admission_adult_covid_suspected_30-39` <dbl> ~
## $ `previous_day_admission_adult_covid_suspected_30-39_coverage` <dbl> ~
## $ `previous_day_admission_adult_covid_suspected_40-49` <dbl> ~
## $ `previous_day_admission_adult_covid_suspected_40-49_coverage` <dbl> ~
## $ `previous_day_admission_adult_covid_suspected_50-59` <dbl> ~
## $ `previous_day_admission_adult_covid_suspected_50-59_coverage` <dbl> ~
## $ `previous_day_admission_adult_covid_suspected_60-69` <dbl> ~
## $ `previous_day_admission_adult_covid_suspected_60-69_coverage` <dbl> ~
## $ `previous_day_admission_adult_covid_suspected_70-79` <dbl> ~
## $ `previous_day_admission_adult_covid_suspected_70-79_coverage` <dbl> ~
## $ `previous_day_admission_adult_covid_suspected_80+` <dbl> ~
## $ `previous_day_admission_adult_covid_suspected_80+_coverage` <dbl> ~
## $ previous_day_admission_adult_covid_suspected_unknown <dbl> ~
## $ previous_day_admission_adult_covid_suspected_unknown_coverage <dbl> ~
## $ deaths_covid <dbl> ~
## $ deaths_covid_coverage <dbl> ~
##
## No file has been downloaded, will use existing file: ./RInputFiles/Coronavirus/vaxData_downloaded_210902.csv
##
## -- Column specification --------------------------------------------------------
## cols(
## .default = col_double(),
## Date = col_character(),
## Location = col_character()
## )
## i Use `spec()` for the full column specifications.
##
## *** File has been checked for uniqueness by: state date
##
##
## Checking for similarity of: column names
## In reference but not in current:
## In current but not in reference:
##
## Checking for similarity of: date
## In reference but not in current: 0
## In current but not in reference: 29
##
## Checking for similarity of: state
## In reference but not in current:
## In current but not in reference:
##
##
## ***Differences of at least 1 and at least 1%
##
## [1] date name newValue refValue absDelta pctDelta
## <0 rows> (or 0-length row.names)
##
##
## ***Differences of at least 0 and at least 0.1%
##
## [1] state name newValue refValue absDelta pctDelta
## <0 rows> (or 0-length row.names)
##
##
##
## Raw file for vax:
## Rows: 16,998
## Columns: 69
## $ date <date> 2021-09-01, 2021-09-01, 2021-0~
## $ MMWR_week <dbl> 35, 35, 35, 35, 35, 35, 35, 35,~
## $ state <chr> "KS", "NY", "RP", "NC", "IN", "~
## $ Distributed <dbl> 3585815, 27518855, 29820, 13316~
## $ Distributed_Janssen <dbl> 173500, 1253900, 3800, 646500, ~
## $ Distributed_Moderna <dbl> 1498900, 10968420, 20800, 54326~
## $ Distributed_Pfizer <dbl> 1913415, 15296535, 5220, 723687~
## $ Distributed_Unk_Manuf <dbl> 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0~
## $ Dist_Per_100K <dbl> 123084, 141459, 166527, 126963,~
## $ Distributed_Per_100k_12Plus <dbl> 146258, 164064, 195004, 148194,~
## $ Distributed_Per_100k_18Plus <dbl> 162029, 178401, 213809, 162641,~
## $ Distributed_Per_100k_65Plus <dbl> 754135, 834880, 982861, 760441,~
## $ vxa <dbl> 2919234, 24428883, 29007, 10495~
## $ Administered_12Plus <dbl> 2919103, 24426700, 29007, 10481~
## $ Administered_18Plus <dbl> 2734777, 22985019, 26820, 98589~
## $ Administered_65Plus <dbl> 825173, 5633411, 3180, 2918484,~
## $ Administered_Janssen <dbl> 101837, 1072305, 2256, 390218, ~
## $ Administered_Moderna <dbl> 1185497, 9356997, 23828, 403072~
## $ Administered_Pfizer <dbl> 1630976, 13991672, 2923, 607437~
## $ Administered_Unk_Manuf <dbl> 924, 7909, 0, 463, 23170, 19, 8~
## $ Administered_Fed_LTC <dbl> 90122, 441057, 0, 228485, 14339~
## $ Administered_Fed_LTC_Residents <dbl> 45956, 211789, 0, 112435, 91660~
## $ Administered_Fed_LTC_Staff <dbl> 28092, 156003, 0, 73210, 37398,~
## $ Administered_Fed_LTC_Unk <dbl> 16074, 73265, 0, 42840, 14337, ~
## $ Administered_Fed_LTC_Dose1 <dbl> 50821, 263888, 0, 137030, 81403~
## $ Administered_Fed_LTC_Dose1_Residents <dbl> 24675, 119940, 0, 63622, 50214,~
## $ Administered_Fed_LTC_Dose1_Staff <dbl> 16838, 90356, 0, 42876, 21594, ~
## $ Administered_Fed_LTC_Dose1_Unk <dbl> 9308, 53592, 0, 30532, 9595, 32~
## $ Admin_Per_100k <dbl> 100203, 125575, 161987, 100073,~
## $ Admin_Per_100k_12Plus <dbl> 119065, 145629, 189687, 116651,~
## $ Admin_Per_100k_18Plus <dbl> 123574, 149009, 192299, 120417,~
## $ Admin_Per_100k_65Plus <dbl> 173543, 170909, 104812, 166666,~
## $ Recip_Administered <dbl> 3015591, 24362987, 29253, 10393~
## $ Administered_Dose1_Recip <dbl> 1673114, 13136849, 16802, 58541~
## $ Administered_Dose1_Pop_Pct <dbl> 57.4, 67.5, 93.8, 55.8, 50.2, 5~
## $ Administered_Dose1_Recip_12Plus <dbl> 1672986, 13135259, 16802, 58453~
## $ Administered_Dose1_Recip_12PlusPop_Pct <dbl> 68.2, 78.3, 99.9, 65.1, 59.3, 6~
## $ Administered_Dose1_Recip_18Plus <dbl> 1563564, 12335911, 15524, 54900~
## $ Administered_Dose1_Recip_18PlusPop_Pct <dbl> 70.7, 80.0, 99.9, 67.1, 61.7, 7~
## $ Administered_Dose1_Recip_65Plus <dbl> 456535, 2951707, 1761, 1528477,~
## $ Administered_Dose1_Recip_65PlusPop_Pct <dbl> 96.0, 89.6, 58.0, 87.3, 85.4, 8~
## $ vxc <dbl> 1408917, 11725228, 14704, 48718~
## $ vxcpoppct <dbl> 48.4, 60.3, 82.1, 46.5, 46.4, 4~
## $ Series_Complete_12Plus <dbl> 1408894, 11724573, 14704, 48665~
## $ Series_Complete_12PlusPop_Pct <dbl> 57.5, 69.9, 96.2, 54.2, 54.7, 5~
## $ vxcgte18 <dbl> 1328055, 11080352, 13791, 46053~
## $ vxcgte18pct <dbl> 60.0, 71.8, 98.9, 56.2, 57.3, 5~
## $ vxcgte65 <dbl> 394170, 2719740, 1687, 1373717,~
## $ vxcgte65pct <dbl> 82.9, 82.5, 55.6, 78.4, 82.8, 7~
## $ Series_Complete_Janssen <dbl> 100534, 1019101, 2260, 383611, ~
## $ Series_Complete_Moderna <dbl> 550051, 4326607, 11443, 1789647~
## $ Series_Complete_Pfizer <dbl> 757989, 6377516, 1001, 2698491,~
## $ Series_Complete_Unk_Manuf <dbl> 343, 2004, 0, 80, 7008, 31, 757~
## $ Series_Complete_Janssen_12Plus <dbl> 100527, 1018977, 2260, 383589, ~
## $ Series_Complete_Moderna_12Plus <dbl> 550044, 4326446, 11443, 1789554~
## $ Series_Complete_Pfizer_12Plus <dbl> 757980, 6377160, 1001, 2693362,~
## $ Series_Complete_Unk_Manuf_12Plus <dbl> 343, 1990, 0, 80, 7008, 31, 757~
## $ Series_Complete_Janssen_18Plus <dbl> 100443, 1018434, 2260, 382326, ~
## $ Series_Complete_Moderna_18Plus <dbl> 549764, 4324978, 11443, 1786935~
## $ Series_Complete_Pfizer_18Plus <dbl> 677527, 5735029, 88, 2436020, 1~
## $ Series_Complete_Unk_Manuf_18Plus <dbl> 321, 1911, 0, 78, 6947, 30, 698~
## $ Series_Complete_Janssen_65Plus <dbl> 16575, 168165, 221, 44400, 2774~
## $ Series_Complete_Moderna_65Plus <dbl> 189386, 1295280, 1456, 660640, ~
## $ Series_Complete_Pfizer_65Plus <dbl> 188040, 1255416, 10, 668639, 42~
## $ Series_Complete_Unk_Manuf_65Plus <dbl> 169, 879, 0, 38, 3493, 18, 160,~
## $ Series_Complete_FedLTC <dbl> 39003, 175255, 0, 90598, 61904,~
## $ Series_Complete_FedLTC_Residents <dbl> 20959, 90116, 0, 47822, 41207, ~
## $ Series_Complete_FedLTC_Staff <dbl> 11153, 64362, 0, 29613, 15716, ~
## $ Series_Complete_FedLTC_Unknown <dbl> 6891, 20777, 0, 13163, 4981, 10~
##
## Column sums before and after applying filtering rules:
## # A tibble: 3 x 6
## isType tot_cases tot_deaths new_cases new_deaths n
## <chr> <dbl> <dbl> <dbl> <dbl> <dbl>
## 1 before 9.39e+9 1.85e+8 3.92e+7 631618 34692
## 2 after 9.35e+9 1.84e+8 3.90e+7 628537 29988
## 3 pctchg 4.25e-3 4.13e-3 4.79e-3 0.00488 0.136
##
##
## Processed for cdcDaily:
## Rows: 29,988
## Columns: 6
## $ date <date> 2021-01-25, 2021-02-02, 2020-07-30, 2020-06-15, 2020-07-31~
## $ state <chr> "NE", "IL", "ME", "WI", "ND", "CT", "WI", "NV", "AL", "MI",~
## $ tot_cases <dbl> 187923, 1130917, 3910, 25480, 6602, 267337, 98440, 324132, ~
## $ tot_deaths <dbl> 1894, 21336, 123, 700, 103, 7381, 1237, 5586, 11152, 0, 116~
## $ new_cases <dbl> 646, 2304, 22, 185, 133, 0, 1502, 128, 502, 0, 394, 603, 33~
## $ new_deaths <dbl> 15, 63, 2, 2, 0, 0, 8, 0, 6, 0, 32, 30, 15, 18, 2, 0, 39, 0~
##
## Column sums before and after applying filtering rules:
## # A tibble: 3 x 5
## isType inp hosp_adult hosp_ped n
## <chr> <dbl> <dbl> <dbl> <dbl>
## 1 before 3.06e+7 2.46e+7 531377 29378
## 2 after 3.04e+7 2.45e+7 518452 28311
## 3 pctchg 5.55e-3 5.50e-3 0.0243 0.0363
##
##
## Processed for cdcHosp:
## Rows: 28,311
## Columns: 5
## $ date <date> 2020-07-24, 2020-07-23, 2020-07-22, 2020-07-22, 2020-07-21~
## $ state <chr> "ND", "ND", "IA", "ND", "ND", "ND", "KY", "ND", "HI", "LA",~
## $ inp <dbl> 52, 54, 0, 51, 46, 44, 532, 46, 44, 1521, 42, 205, 50, 841,~
## $ hosp_adult <dbl> NA, NA, 0, NA, NA, NA, 500, NA, 27, 1482, NA, NA, NA, NA, N~
## $ hosp_ped <dbl> NA, NA, 0, NA, NA, NA, 0, NA, 0, 0, NA, NA, NA, NA, NA, NA,~
##
## Column sums before and after applying filtering rules:
## # A tibble: 3 x 9
## isType vxa vxc vxcpoppct vxcgte65 vxcgte65pct vxcgte18 vxcgte18pct
## <chr> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
## 1 before 1.05e+11 4.47e+10 399452. 1.39e+10 708373. 4.32e+10 490082.
## 2 after 5.02e+10 2.16e+10 337472. 6.73e+ 9 644868. 2.09e+10 419494.
## 3 pctchg 5.24e- 1 5.16e- 1 0.155 5.16e- 1 0.0896 5.16e- 1 0.144
## # ... with 1 more variable: n <dbl>
##
##
## Processed for vax:
## Rows: 13,362
## Columns: 9
## $ date <date> 2021-09-01, 2021-09-01, 2021-09-01, 2021-09-01, 2021-09-0~
## $ state <chr> "KS", "NY", "NC", "IN", "NV", "TX", "NH", "MD", "FL", "AL"~
## $ vxa <dbl> 2919234, 24428883, 10495776, 6431733, 3213855, 30268539, 1~
## $ vxc <dbl> 1408917, 11725228, 4871829, 3121678, 1477405, 13802230, 81~
## $ vxcpoppct <dbl> 48.4, 60.3, 46.5, 46.4, 48.0, 47.6, 59.7, 61.6, 53.2, 38.4~
## $ vxcgte65 <dbl> 394170, 2719740, 1373717, 898666, 377734, 2913651, 222210,~
## $ vxcgte65pct <dbl> 82.9, 82.5, 78.4, 82.8, 76.2, 78.0, 87.5, 89.3, 82.3, 72.6~
## $ vxcgte18 <dbl> 1328055, 11080352, 4605359, 2961264, 1400878, 12729288, 76~
## $ vxcgte18pct <dbl> 60.0, 71.8, 56.2, 57.3, 58.7, 58.9, 69.6, 73.7, 63.2, 47.4~
##
## Integrated per capita data file:
## Rows: 30,201
## Columns: 34
## $ date <date> 2020-01-01, 2020-01-01, 2020-01-01, 2020-01-01, 2020-01-0~
## $ state <chr> "AL", "HI", "IN", "LA", "MN", "MT", "NC", "TX", "AL", "HI"~
## $ tot_cases <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA~
## $ tot_deaths <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA~
## $ new_cases <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA~
## $ new_deaths <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA~
## $ inp <dbl> NA, 0, 0, NA, 0, 0, 0, 0, NA, 0, 0, NA, 0, 0, 0, 1877, 0, ~
## $ hosp_adult <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA~
## $ hosp_ped <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA~
## $ vxa <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA~
## $ vxc <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA~
## $ vxcpoppct <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA~
## $ vxcgte65 <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA~
## $ vxcgte65pct <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA~
## $ vxcgte18 <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA~
## $ vxcgte18pct <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA~
## $ tcpm <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA~
## $ tdpm <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA~
## $ cpm <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA~
## $ dpm <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA~
## $ hpm <dbl> NA, 0.0000, 0.0000, NA, 0.0000, 0.0000, 0.0000, 0.0000, NA~
## $ ahpm <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA~
## $ phpm <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA~
## $ vxapm <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA~
## $ vxcpm <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA~
## $ tcpm7 <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA~
## $ tdpm7 <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA~
## $ cpm7 <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA~
## $ dpm7 <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA~
## $ hpm7 <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA~
## $ ahpm7 <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA~
## $ phpm7 <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA~
## $ vxapm7 <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA~
## $ vxcpm7 <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA~
## Warning in showSRID(uprojargs, format = "PROJ", multiline = "NO", prefer_proj =
## prefer_proj): Discarded datum unknown in CRS definition
saveToRDS(cdc_daily_210902)
The pivoted file and summaries are also created:
hospAge_210902 <- cdc_daily_210902$dfRaw$cdcHosp %>%
select(state,
date,
grep(x=names(.), pattern="ed_\\d.*[9+]$", value=TRUE),
grep(x=names(.), pattern="pediatric.*ed$", value=TRUE)
) %>%
pivot_longer(-c(state, date)) %>%
mutate(confSusp=ifelse(grepl(x=name, pattern="confirmed"), "confirmed", "suspected"),
adultPed=ifelse(grepl(x=name, pattern="adult"), "adult", "ped"),
age=ifelse(adultPed=="ped", "0-17", stringr::str_replace_all(string=name, pattern=".*_", replacement="")),
age=ifelse(age %in% c("0-17", "18-19"), "0-19", age),
div=as.character(state.division)[match(state, state.abb)]
)
hospAge_210902
## # A tibble: 528,804 x 8
## state date name value confSusp adultPed age div
## <chr> <date> <chr> <dbl> <chr> <chr> <chr> <chr>
## 1 ND 2020-07-24 previous_day_admiss~ NA confirm~ adult 0-19 West Nor~
## 2 ND 2020-07-24 previous_day_admiss~ NA confirm~ adult 20-29 West Nor~
## 3 ND 2020-07-24 previous_day_admiss~ NA confirm~ adult 30-39 West Nor~
## 4 ND 2020-07-24 previous_day_admiss~ NA confirm~ adult 40-49 West Nor~
## 5 ND 2020-07-24 previous_day_admiss~ NA confirm~ adult 50-59 West Nor~
## 6 ND 2020-07-24 previous_day_admiss~ NA confirm~ adult 60-69 West Nor~
## 7 ND 2020-07-24 previous_day_admiss~ NA confirm~ adult 70-79 West Nor~
## 8 ND 2020-07-24 previous_day_admiss~ NA confirm~ adult 80+ West Nor~
## 9 ND 2020-07-24 previous_day_admiss~ NA suspect~ adult 0-19 West Nor~
## 10 ND 2020-07-24 previous_day_admiss~ NA suspect~ adult 20-29 West Nor~
## # ... with 528,794 more rows
dfPivot_210902 <- makeCaseHospDeath(dfHosp=hospAge_210902, dfCaseDeath=cdc_daily_210902$dfPerCapita)
## Joining, by = "state"
##
## *** File has been checked for uniqueness by: state date name
dfPivot_210902
## # A tibble: 329,742 x 4
## state date name value
## <chr> <date> <chr> <dbl>
## 1 AL 2020-01-01 0-19 NA
## 2 AL 2020-01-01 20-59 NA
## 3 AL 2020-01-01 60+ NA
## 4 HI 2020-01-01 0-19 NA
## 5 HI 2020-01-01 20-59 NA
## 6 HI 2020-01-01 60+ NA
## 7 IN 2020-01-01 0-19 NA
## 8 IN 2020-01-01 20-59 NA
## 9 IN 2020-01-01 60+ NA
## 10 LA 2020-01-01 0-19 NA
## # ... with 329,732 more rows
# Plot for overall trends by age group
p1 <- hospAge_210902 %>%
filter(state %in% c(state.abb, "DC"), !is.na(value)) %>%
mutate(ageBucket=age) %>%
group_by(date, ageBucket) %>%
summarize(value=sum(value), .groups="drop") %>%
arrange(date) %>%
group_by(ageBucket) %>%
mutate(value7=zoo::rollmean(value, k=7, fill=NA)) %>%
filter(date >= "2020-08-01") %>%
ggplot(aes(x=date, y=value7)) +
labs(x=NULL,
y="Confirmed or suspected COVID admissions (rolling-7 mean)",
title="Hospital admissions for COVID by age bucket (Aug 2020 - Aug 2021)",
subtitle="50 states and DC (includes confirmed and suspected from CDC data)"
) +
lims(y=c(0, NA))
p1 + geom_line(aes(group=ageBucket, color=ageBucket), size=1) +
scale_color_discrete("Age\nbucket")
## Warning: Removed 24 row(s) containing missing values (geom_path).
p1 + geom_col(aes(fill=ageBucket), position="stack") +
scale_color_discrete("Age\nbucket")
## Warning: Removed 24 rows containing missing values (position_stack).
p1 + geom_col(aes(fill=ageBucket), position="fill") +
scale_color_discrete("Age\nbucket")
## Warning: Removed 24 rows containing missing values (position_stack).
# Plot for overall trends by age group
hospAge_210902 %>%
filter(state %in% state.abb, !is.na(value)) %>%
mutate(ageBucket=ifelse(age >= "60", "60+", ifelse(age=="0-19", "0-19", "20-59"))) %>%
group_by(date, state, ageBucket) %>%
summarize(value=sum(value), .groups="drop") %>%
group_by(ageBucket, state) %>%
mutate(value7=zoo::rollmean(value, k=7, fill=NA)) %>%
filter(date >= "2020-06-01") %>%
ggplot(aes(x=date, y=value7)) +
geom_line(aes(color=ageBucket, group=ageBucket)) +
scale_color_discrete("Age\nbucket") +
labs(x=NULL,
y="Confirmed or suspected COVID admissions (rolling-7 mean)",
title="Hospital admissions for COVID by age bucket (Aug 2020 - Aug 2021)"
) +
lims(y=c(0, NA)) +
facet_wrap(~state, scales="free_y")
## Warning: Removed 18 row(s) containing missing values (geom_path).
onePageCFRPlot(dfPivot_210902, keyState="FL", minDate="2020-08-01")
onePageCFRPlot(dfPivot_210902, keyState="LA", minDate="2020-08-01")
onePageCFRPlot(dfPivot_210902, keyState="OR", minDate="2020-08-01")
onePageCFRPlot(dfPivot_210902, keyState="HI", minDate="2020-08-01")